Reputation: 5757
SELECT
'8 / 10 Valle Seti'
REGEXP
'([1-9][0-9]|[2-9][0-9]) (Valle Seti)'
This returns 1 in mysql. How is that possible? I am only specifying two digits greater than 10, followed by a word, but this is matching a single digit, followed by a slash, then a two digit number. Am I missing something here?
Upvotes: 0
Views: 110
Reputation: 263893
because it founds a match on the string (which is 10 Valle Seti
), try adding assert beginning
and end
character
SELECT
'8 / 10 Valle Seti'
REGEXP
'(^[1-9][0-9]|[2-9][0-9]) (Valle Seti)$'
See SQLFiddle Demo
Upvotes: 2
Reputation: 1508
Your regex is matching
'10 Valle Seti'
from
'8 / 10 Valle Seti'
To force the regex to start and end at the string ends, change it to
REGEXP
'^([1-9][0-9]|[2-9][0-9]) (Valle Seti)$'
Upvotes: 3