Re: regexp problem

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: regexp problem
Date: 2011-02-24 18:39:48
Message-ID: 4D66A5F4.90100@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2011-02-24 18:50:08 Re: Adding a column with constraint
Previous Message Alexander Farber 2011-02-24 18:30:32 Adding a column with constraint