homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

How To Match A Regular Expression With Another Regular Expression?
Mysql. Tricky Stuff.

 6:36 am on Sep 21, 2005 (gmt 0)

I am trying to match a regular expression with another regular expression that is stored inside a row in a table in mysql.

a. good +morning girl -afternoon
b. good +morning -girl <-- this stores inside the DB.

Don't need to say, they won't match because of word "girl". This is exactly what I want.

How do I write a query this do this? I was think of usine REGEXP, but it's hard still because I am matching a target which is a regular expression not a string. Things can get much more complicate when I combine a bunch of "and" and "or" and "not" statements.

Many thanks.



 7:00 am on Sep 21, 2005 (gmt 0)

Not sure I can help coz it is tricky stuff as you say and I may got it wrong.

Let me just suggest that I would explode() your regular expression, separators being your "and", "or", etc. and other popular statements you may use.

Then, compare each element of your regular with each element of your "master" regular expression by using the similar_text() function.

Am I right? It is just a guess!


 4:22 pm on Sep 21, 2005 (gmt 0)

Convert to "and", "or", "not" statements is easy, but match both is not. similar_text() won't help.

For examples:

a. good AND morning NOT afternoon
b. good OR morning

They don't match because b can be just "good" and a can be "good morning".

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved