Re: order of (escaped) characters in regex range

From: InterRob <rob(dot)marjot(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: order of (escaped) characters in regex range
Date: 2011-12-13 13:29:08
Message-ID: CA+DVeYDSAM9bK+bhCH7cF4KynLFFAYgrGoU-bBvZt+VAtftghA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

True, but still weird...

And are you sure it does the same thing?

2011/12/13 Szymon Guz <mabewlun(at)gmail(dot)com>

>
>
> On 13 December 2011 14:04, InterRob <rob(dot)marjot(at)gmail(dot)com> wrote:
>
>> Dear List,
>>
>> I found this interesting:
>>
>> SELECT regexp_matches('123-A' , E'(3[A-Z\- ])');
>> ERROR: invalid regular expression: invalid character range
>>
>> whereas:
>> SELECT regexp_matches('123-A' , E'(3[\- A-Z])');
>> regexp_matches
>> ----------------
>> {3-}
>> (1 row)
>>
>> Notice the order of (escaped) characters and ranges in the last bit of
>> the expression.
>>
>> Am I missing some key concept of the regular expression?
>>
>> Regards,
>> Rob
>>
>
> Hi Rob,
> try '\\-' instead of '\-'
> and it works :)
>
> regards
> Szymon
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2011-12-13 13:30:51 Re: order of (escaped) characters in regex range
Previous Message Rob Marjot 2011-12-13 13:28:04 Re: order of (escaped) characters in regex range