Why is the following instruction returning FALSE
?
SELECT \'[1-3]{5}\' SIMILAR TO \'22222\' ;
I can\'t find what is wrong with that
Your basic error has already been answered.
More importantly, don't use SIMILAR TO
at all. It's completely pointless:
Use LIKE
or regular expression match ~
or other pattern matching operators:
For 5 digits between 1 and 3 use the expression @Thomas provided.
If you actually want 5 identical digits between 1 and 3 like your example suggests I suggest a back reference:
SELECT '22222' ~ '([1-9])\1{4}'
Related answer with more explanation:
Deleting records with number repeating more than 5
SQL Fiddle demonstrating both.