Re: trouble with regular expression

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pushker Chaubey <pchaubey(at)vertex(dot)co(dot)in>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: trouble with regular expression
Date: 2008-06-04 18:37:29
Message-ID: 27826.1212604649@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Pushker Chaubey <pchaubey(at)vertex(dot)co(dot)in> writes:
> (Please note that I just replaced similar to with ~*)

They're not the same ... SIMILAR TO is SQL-spec which is almost entirely
unlike POSIX.

You can get there using the undocumented similar_escape function:
"a SIMILAR TO b" is actually implemented as "a ~ similar_escape(b,null)",
so "a ~* similar_escape(b,null)" should do what you want.

regards, tom lane

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Pushker Chaubey 2008-06-05 06:44:08 Re: trouble with regular expression
Previous Message Pushker Chaubey 2008-06-04 18:08:43 trouble with regular expression