Re: regexp problem - Mailing list pgsql-general

From Steve Crawford
Subject Re: regexp problem
Date
Msg-id 4D66A5F4.90100@pinpointresearch.com
Whole thread Raw
In response to regexp problem  ("Gauthier, Dave" <dave.gauthier@intel.com>)
Responses Re: regexp problem
List pgsql-general
On 02/24/2011 10:25 AM, Gauthier, Dave wrote:
select 'abc.def[0]' ~ E'^[a-zA-Z0-9_\.\[\]]+$';

Try:
E'^[a-zA-Z0-9._\\[\\]]+$'

The "outer" level of parsing turns that into '^[a-zA-Z0-9._\[\]]+$' which is the regex you want. Also, I'm *pretty sure* you don't need to escape the '.' within a character class.

Cheers,
Steve

pgsql-general by date:

Previous
From: Alexander Farber
Date:
Subject: Adding a column with constraint
Next
From: Andrew Sullivan
Date:
Subject: Re: Adding a column with constraint