I’m trying to find words of three letters from a given set using the next syntax:
SELECT * FROM words WHERE word REGEXP '^[dcqaahii]{3}'
and it returns words with more than three letters. I thought that {3} limit the length of the output.
Any one know what’s wrong in my expression?
Thanks in advance.
REGEXP, unlikeLIKE, does not have to match the whole string. It only needs to match a portion of the string.If you want columns that match your regex exactly, you need to include both the BOL and EOL characters in your regex:
regular-expressions.info has more details.