tags:

views:

21

answers:

1

I have several rows with strings similar to this: 1,19|11|14,2
The info I want to look at is: 19|11|14 (which is a list of the numbers, 19 11 and 14)
This info should be matched to see if any of the numbers are in the range between 8 and 13

What's the most effective way to accomplish this? I tried using a regexp like:
[^0-9]*(8|9|10|11|12|13)[^0-9]*
But this would also match the number 9 which is actually 19.

Other methods for parsing the string is also welcomed, only functions available in MySQL 5.0 can be used.

+2  A: 

From what I remember MySQLs Regex support is very simplistic I'm not sure how possible this will actually be. I don't believe it supports word boundaries or look around assertions. How about this...

(^|[^0-9])(8|9|10|11|12|13)([^0-9]|$)
Cags
Seems to be working! thank you
baloo