~
is case-sensitive by default.~*
is the case-insensitive variant.This gets you 'boston' but not 'Boston':
SELECT cityFROM targetsWHERE city ~ '^b.*n$';
See:
but
LIKE
is not case insensitive.
You may have tripped over the double negative there, but "not case insensitive" (i.e. case-sensitive) is what you want. And it's also how LIKE
works in Postgres (or standard SQL):
SELECT cityFROM targetsWHERE city LIKE 'b%n';
If you want case-insensitive, use ILIKE
in Postgres.
db<>fiddle here
But MySQL does it differently:
db<>fiddle here
See: