MySQL Forums
Forum List  »  PHP

REGEXP() Question
Posted by: Sheena Archambault
Date: June 12, 2009 07:59AM

I'm somewhat new to REGEXP() and I'd like to know if there's a way to combine the following into a single REGEXP

($field REGEXP '[ .:,]".$term."[ .,:]'
OR $field = '".$term."'
OR $field REGEXP '[ .:,]".$term."$'
OR $field REGEXP '^".$term."[ .:,]' )" ;

Basically I want to find my search to find whole words/terms/numbers only. the term could have spaces on both sides, or could have a space on one side and a . or , or : on the other. Or the term could be the entire field, or at one end or the other of the field. I'd like to combine all this into a single REGEXP if possible.

Thank You!

Options: ReplyQuote

Written By
REGEXP() Question
June 12, 2009 07:59AM
June 13, 2009 09:59AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.