2

I want to match 2 exact words like

select col from mytable where col like '%one%two%'

but using

select col from mytable where col RLIKE '[[:<:]]one[[:>:]][[:<:]]two[[:>:]]'

it didnt' work. Any help is appreciated.

Lastand
  • 23
  • 3
  • Did you try full text search? http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html – bksi Oct 25 '13 at 21:43

1 Answers1

1

Your regex is incorrect. You need .* between one and two as these are 2 different words. .* will match 0 or more length text between these 2 words.

Use this query:

select col from mytable where col RLIKE '[[:<:]]one[[:>:]].*[[:<:]]two[[:>:]]'
anubhava
  • 761,203
  • 64
  • 569
  • 643