Re: Escaping parenthesis in regular expressions....

From: Charles Tassell <ctassell(at)isn(dot)net>
To: "Steve Wolfe" <steve(at)iboats(dot)com>, "Pgsql-General" <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: Escaping parenthesis in regular expressions....
Date: 2000-07-14 18:57:51
Message-ID: 4.3.2.7.2.20000714155348.00acd540@mailer.isn.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2000-07-14 21:19:18 Re: Escaping parenthesis in regular expressions....
Previous Message Yves Dorfsman 2000-07-14 18:19:38 Re: Postgresql and Postmaster response