Re: order of (escaped) characters in regex range

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: rob(at)marjot-multisoft(dot)com
Cc: David Johnston <polobo(at)yahoo(dot)com>, Szymon Guz <mabewlun(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: order of (escaped) characters in regex range
Date: 2011-12-13 14:14:35
Message-ID: 20111213141435.GA10626@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sogard, Michael (DPS) 2011-12-13 16:10:54 Re: Having Issue Getting the Postgresql Service to Start
Previous Message InterRob 2011-12-13 13:51:15 Re: order of (escaped) characters in regex range