【发布时间】:2013-10-25 21:40:30
【问题描述】:
我想匹配 2 个确切的词,例如
select col from mytable where col like '%one%two%'
但使用
select col from mytable where col RLIKE '[[:<:]]one[[:>:]][[:<:]]two[[:>:]]'
它没有工作。任何帮助表示赞赏。
【问题讨论】:
我想匹配 2 个确切的词,例如
select col from mytable where col like '%one%two%'
但使用
select col from mytable where col RLIKE '[[:<:]]one[[:>:]][[:<:]]two[[:>:]]'
它没有工作。任何帮助表示赞赏。
【问题讨论】:
您的正则表达式不正确。您需要在one 和two 之间使用.*,因为它们是两个不同的词。 .* 将匹配这 2 个单词之间的 0 个或更多长度的文本。
使用这个查询:
select col from mytable where col RLIKE '[[:<:]]one[[:>:]].*[[:<:]]two[[:>:]]'
【讨论】: