Thread: Reg Ex help!
View Single Post
Old 04-06-2011, 02:06 PM  
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,108
Data set in a table called testit, fieldname name.

quinton jackson
quinton rampage jackson
Bill smith
quinton smith
bill jackson
quenton jockson

SELECT * FROM testit WHERE name REGEXP 'quinton.*jackson'

Returns:

quinton jackson
quinton rampage jackson

SELECT * FROM testit WHERE name REGEXP 'quinton.*'

Returns:

quinton jackson
quinton rampage jackson
quinton smith

select * from testit where name regexp 'q.*j.*'

Returns:

quinton jackson
quinton rampage jackson
quenton jockson

SELECT * FROM `testit` WHERE name REGEXP '.*j.*'

Returns:

quinton jackson
quinton rampage jackson
bill jackson
quenton jockson



Do any of those do what you want to do? Those are using extremely simple patterns, pattern matching can get extremely complex.
__________________
All cookies cleared!
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote