Do you have a question? Post it now! No Registration Necessary. Now with pictures!
July 29, 2005, 1:40 pm
rate this thread
I have data in a row, such as "34,54,12,134"
I need to select rows where they match certain numbers, and not others,
so match 34,12 and not 134 (ie the above row would fail, but
"34,124,12" would pass).
How do I build a REGEXP to search this - I've tried
(^34|,34,|,34$) - but that only works to find one match. How do I "AND"
in the REGEXP (regardless of order) and exclude a term?
Maybe there is a much better way of doing this?
Re: REGEXP to select data
I have managed to refine the REGEXP selection a little, but I think I
am not combining the regexp correctly - I know have something like:
SELECT meal FROM recipe WHERE ingrediants REGEXP '(^|,)apple(,|$)'
REGEXP '(^|,)pepper(,|$)' NOT REGEXP '(^|,)nuts(,|$)
The data looks something like:
apple,pepper,carrots (so true)
nuts,apples,pepper (so false)
- » How do you manage changes from development server to production server?
- — Previous thread in » MySQL Database Forum
- » Americanas.com SALDO de TVs Com at 80% de Desconto (29798)
- — Newest thread in » MySQL Database Forum