Re: regexp problem

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: regexp problem
Date: 2011-02-24 20:12:09
Message-ID: 482E80323A35A54498B8B70FF2B87980048B56CF7B@azsmsx504.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yup, that did it. And you're right, you don't need to escape the '.'.
So the extra \ is needed because of the single quotes string. Arrrrgggg..... :-)

Thanks Steve !

From: Steve Crawford [mailto:scrawford(at)pinpointresearch(dot)com]
Sent: Thursday, February 24, 2011 1:40 PM
To: Gauthier, Dave
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] regexp problem

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 Dmitriy Igrishin 2011-02-24 21:08:52 Re: array size
Previous Message John R Pierce 2011-02-24 19:46:48 Re: database is bigger after dump/restore - why? (60 GB to 109 GB)