List Info

Thread: Is there a way to use the "and" operator??




Is there a way to use the "and" operator??
user name
2007-01-16 09:05:59
I am using mysql and have found that rlike is faster 95% of the time over fulltext search and more exact. My question is - Is there a way to have the regex match only if 2 or more words are found. I know that 'country|usa' would have it find either one. I want to know is there a way to have it match only if both are present or do I need to use 2 different rlike regex's in the where clause. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Regex" group. To post to this group, send email to regexgooglegroups.com To unsubscribe from this group, send email to regex-unsubscribegooglegroups.com For more options, visit this group at http://groups-beta.google.com/group/regex -~----------~----~----~----~------~----~------~--~---
Re: Is there a way to use the "and" operator??
user name
2007-01-27 14:31:36
There are a few ways to do this, none of them very
attractive. One is 
to capture all the matches, then go through them
programmatically. 
Another is to use lookaround:

^(?=.*?country).*?usa

Does MySQL even support variable-length lookaround? Since
"usa" can 
come before *or* after "country," this expression
gets rather verbose. 
But if you're writing SQL, why not just AND the two RLIKE
expressions?

On Jan 16, 10:05 am, "Extremest" <a...binindex.net> wrote:
> I am using mysql and have found that rlike is faster
95% of the time
> over fulltext search and more exact.  My question is -
Is there a way
> to have the regex match only if 2 or more words are
found.  I know that
> 'country|usa' would have it find either one.  I want to
know is there a
> way to have it match only if both are present or do I
need to use 2
> different rlike regex's in the where clause.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://grou
ps-beta.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )