Re: DIFFERENCE BETWEEN LIKE AND SIMILAR OPERATORS - Mailing list pgsql-novice

From Bruce Momjian
Subject Re: DIFFERENCE BETWEEN LIKE AND SIMILAR OPERATORS
Date
Msg-id 201003160131.o2G1VhP25162@momjian.us
Whole thread Raw
In response to DIFFERENCE BETWEEN LIKE AND SIMILAR OPERATORS  (JORGE MALDONADO <jorgemal1960@gmail.com>)
Responses Re: DIFFERENCE BETWEEN LIKE AND SIMILAR OPERATORS  (John Gage <jsmgage@numericable.fr>)
List pgsql-novice
JORGE MALDONADO wrote:
> I've been reading PostgreSQL documentation and I do not really understand
> the difference between LIKE and SIMILAR operators. Can someone explain?

SIMILAR is a super-set of LIKE syntax.  Our docs have:

    http://developer.postgresql.org/pgdocs/postgres/functions-matching.html#FUNCTIONS-SIMILARTO-REGEXP

    It is similar to LIKE, except that it interprets the pattern using the
    SQL standard's definition of a regular expression. SQL regular
    expressions are a curious cross between LIKE notation and common regular
    expression notation.

For the super-set, see the bullets below this line:

     In addition to these facilities borrowed from LIKE, SIMILAR TO
    supports these pattern-matching metacharacters borrowed from POSIX
    regular expressions:

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do

pgsql-novice by date:

Previous
From: JORGE MALDONADO
Date:
Subject: DIFFERENCE BETWEEN LIKE AND SIMILAR OPERATORS
Next
From: Jasen Betts
Date:
Subject: Re: PostgreSQL questions