Re: order of (escaped) characters in regex range - Mailing list pgsql-general

From hubert depesz lubaczewski
Subject Re: order of (escaped) characters in regex range
Date
Msg-id 20111213141435.GA10626@depesz.com
Whole thread Raw
In response to Re: order of (escaped) characters in regex range  (InterRob <rob.marjot@gmail.com>)
List pgsql-general
On Tue, Dec 13, 2011 at 02:51:15PM +0100, InterRob wrote:
> Thanks guys, i see what you mean.
>
> I do intend to use the PG escaping, in order to avoid that annoying
> warning... Hence, my expression should indeed be:
> SELECT regexp_matches('123-A' , E'(3[A-Z\\-\\(\\) ])');
>
> In the above expression i added the parentheses as I whish to match these
> as well :))

instead of putting that much quoting just do:
SELECT regexp_matches('123-A' , '(3[A-Z() -])');
 ( and ) don't need to be quoted, and if you'll move - at the beginning
 or end (i prefer end) of range, it doesn't need to be quoted either.

Best regards,

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
                                                             http://depesz.com/

pgsql-general by date:

Previous
From: InterRob
Date:
Subject: Re: order of (escaped) characters in regex range
Next
From: "Sogard, Michael (DPS)"
Date:
Subject: Re: Having Issue Getting the Postgresql Service to Start