【发布时间】:2012-06-23 05:26:48
【问题描述】:
按照这个question and answer,我得到的结果还是有点麻烦,
例如,
REGEXP '>[^<]*lau[[:>:]]' 将只匹配 'lau' 而不是 'laurence' 这是正确的。
REGEXP '>[^<]*men[[:>:]]' 将匹配 'empowerment' 和 'women' 这不是我所追求的。
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 标记中的任何出现。 家乡 - 不匹配
【问题讨论】:
标签: php mysql sql regex word-boundary