Question
I've been instructed "not to bother with LIKE
" and use ~
instead. What is
wrong with LIKE
and how is ~
different?
Does ~
have a name in this context or do people say "use the tilde
operator"?
Answer
~
is the regular expression operator, and has the capabilities implied by
that. You can specify a full range of regular expression wildcards and
quantifiers; see [the
documentation](https://www.postgresql.org/docs/current/static/functions-
matching.html#FUNCTIONS-POSIX-REGEXP) for details. It is certainly more
powerful than LIKE
, and should be used when that power is needed, but they
serve different purposes.