Re: order of (escaped) characters in regex range

From: Merlin Moncure <mmoncure(at)gmail(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 16:38:57
Message-ID: CAHyXU0x-ku0L3L0mywjOmxddutubtzfdb1D+8KSzGwuVhnrp0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Dec 13, 2011 at 7:51 AM, InterRob <rob(dot)marjot(at)gmail(dot)com> 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 :))

I advise dollar quoting when writing complicated regular expressions:

E'(3[A-Z\\-\\(\\) ])'
becomes
$$(3[A-Z\-\(\) ])$$

merlin

In response to

Responses

Browse pgsql-general by date

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