Hello
I need to search using RLIKE in a mysql query...

A table has a field 'datum' which stores 4 CSVs (as '2,5,10,4' excl. quotes for e.g.)

Now a user says he wants to search for rows which have
3 or 4 for the first value
5 or 3 or 10 for the second
2 or 9 or 10 for the third
1 or 3 for the fourth

So I wrote a query like-
SELECT * FROM TABLE WHERE datum RLIKE "(3|4),(5|3|10),(2|9|10),(1|3)"

This is fine except that it fails when searching for a double digit like 10, since RLIKE probably assumes I want either 1 or 0 rather than a whole 10 (or some other reason...).

Am no good at reg exprs, please help!

    Write a Reply...