0

按照这个问答,我得到的结果还是有点麻烦,

例如,

REGEXP '>[^<]*lau[[:>:]]'将仅匹配“ lau ”,但不匹配正确的“ lauren ”。

REGEXP '>[^<]*men[[:>:]]'将匹配'赋权'和'女性',这不是我所追求的。

REGEXP '( |>|$)home( |<|$)'将只匹配 ' home ' 而不是 ' home! ' 它应该

如何正确匹配这些?

例如,

Home - match
HOME - match
welcome home! - match
home is far! - match
hometown - not match
xxhomexx - not match
<a href="home.html">Hello</a> - not match
<p class="home">a box</p> - not match

它不应html 标记中的任何出现匹配。家乡 - 不匹配

4

1 回答 1

2

REGEXP '>[^<]*[[:<:]]home[[:>:]]' 怎么样?

此外,我对您的解决方案的性能真的很感兴趣...为什么不在您的表中有另一列,其中包含去除了 html 标记的文本。然后,您可以充分利用全文搜索,而不是使用复杂的正则表达式。

于 2012-06-21T01:42:40.847 回答