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: order of (escaped) characters in regex range
Date: 2011-12-13 13:04:52
Message-ID: CA+DVeYDq5zHNmJwf5t8gtqPhZ0uCgX5qXXnQP2vV4_EtK_Y7rA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Szymon Guz 2011-12-13 13:09:24 Re: order of (escaped) characters in regex range
Previous Message Dave Cramer 2011-12-13 11:18:53 Re: WAL file accumulation on log shipping primary node