Reputation: 621
Hi I don't understand why my pattern does not work. It seems to be the same as in many examples I've seen on the Internet. Can you help?
select city from cities where city like 'ny';
56 rows
select city from cities where city like '[a-z][a-z]';
0 row
Upvotes: 0
Views: 928
Reputation: 23666
LIKE
is no comparator for Regular Expressions (Documentation)
You should take ~
comparator or SIMILAR TO
:
SELECT
*
FROM cities
WHERE city ~ '[a-z][a-z]';
SELECT
*
FROM cities
WHERE city SIMILAR TO '[a-z][a-z]';
Upvotes: 3