【发布时间】:2011-03-10 20:05:22
【问题描述】:
我有一个带有 blob 文本字段的表格。这个 blob 中有很多 html。其中一个 html 是 h2。我想在 h2 标签中找到一个单词的所有实例,并将其替换为另一个单词(同时保持其他单词相同)。
例如,我想将下面的 h2 “wiggles”替换为“bumbles”:
之前:
<h2>This is some wiggles html!</h2>
<p>And here is some more wiggles html that could be ignored</p>
<h2>And this is a decoy h2</h2>
之后:
<h2>This is some bumbles html!</h2>
<p>And here is some more wiggles html that could be ignored</p>
<h2>And this is a decoy h2</h2>
我担心的一个陷阱是正则表达式不会在第一个 h2 结束时停止,而是一直持续到它的最后一个结束。
我可以访问 shell 和 phpmyadmin。
【问题讨论】:
-
只想为笨拙和摆动而 +1 是错误的吗?
-
哈哈,我不会抱怨的:)。一定要让事情变得有趣;)
标签: php mysql replace phpmyadmin