Postgres supports SIMILAR TO and POSIX regular expressions allowing writing more powerful regular expressions than the LIKE operator does. https://www.postgresql.org/docs/7.3/functions-matching.html
I am using Knex to run queries on a Postgres database.
I know how to use LIKE with knex but I could not find the support for SIMILAR TO or POSIX regular expressions.
How can I use SIMILAR TO with knex or even better the POSIX expressions?
I found the support for POSIX. It seems the SIMILAR TO operator is not supported. However, that is okay as POSIX allows to write more powerful regex than SIMILAR TO.
.where('column', '~', 'pattern');
~: case sensitive match
~*: case-insensitive match
!~ and !~* negation of the corresponding operator.