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