Re: Escaping parenthesis in regular expressions.... - Mailing list pgsql-general

From Charles Tassell
Subject Re: Escaping parenthesis in regular expressions....
Date
Msg-id 4.3.2.7.2.20000714155348.00acd540@mailer.isn.net
Whole thread Raw
In response to Escaping parenthesis in regular expressions....  ("Steve Wolfe" <steve@iboats.com>)
List pgsql-general
You were close, you need two backslashes.  IE, '401\\(k\\)'  The reasoning
for this is that the first slash is taken off by the preprocessor, and then
it goes through another processor for the regular expression
matching.  BTW: If you ever want to doa  search for a slash itself, you
need 4 slashes, ie: 'This \\\\ way'


At 03:00 PM 7/14/00, Steve Wolfe wrote:

>   How does one escape parenthesis in a regular expression in Postgres?
>
>   An example is:
>
>select * from subcategories where subcategory ~* '401(k)';
>
>Which does not work.  I've tried:
>
>select * from subcategories where subcategory ~* '401\(k\)';
>
>That still didn't work.  Any advice would be much appreciated.  BTW,
>
>select * from subcategories where subcategory  =  '401(k)';
>
>does work. ; )
>
>steve


pgsql-general by date:

Previous
From: Yves Dorfsman
Date:
Subject: Re: Postgresql and Postmaster response
Next
From: Tom Lane
Date:
Subject: Re: Escaping parenthesis in regular expressions....