List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 31 2002 5:09am
Subject:Re: OR replaced by REGEXP?
View as plain text  
At 21:57 -0700 7/30/02, Erick Papadakis wrote:
>thanks for those who helped about my OR query in the join, if the sql
>containes "IN (something)" it is much faster. but i have a similar
>question relating to regexp. sorry i am not too good with regexp so
>wouldapprecite some help.
>my sql is like this:
>   where col1 like '%abc%'  or col1 like '%cdf%' or col1 like '%fgh%'
>how can i break this into a regexp query, so that i can remove the OR
>condition altogether and instead rely on regexp? can i do that? like
>    where REGEXP(col1, "^[abc|cdf|fgh]$")

You don't want ^ or $ if you want to find the the strings anywhere in
the column value.

Also, REGEXP is an operator, not a function.

WHERE col1 REGEXP "abc|cdf|fgh"

>or something like that?

OR replaced by REGEXP?Erick Papadakis31 Jul
  • Re: OR replaced by REGEXP?Paul DuBois31 Jul