Pattern Matching

9.7. Pattern Matching

There are three separate approaches to pattern matching provided by PostgreSQL: the traditional SQL LIKE operator, the more recent SIMILAR TO operator (added in SQL:1999), and POSIX-style regular expressions. Aside from the basic "does this string match this pattern?" operators, functions are available to extract or replace matching substrings and to split a string at matching locations.

Tip: If you have pattern matching needs that go beyond this, consider writing a user-defined function in Perl or Tcl.

Caution: While most regular-expression searches can be executed very quickly, regular expressions