Re: order of (escaped) characters in regex range

Поиск
Список
Период
Сортировка
От Szymon Guz
Тема Re: order of (escaped) characters in regex range
Дата
Msg-id CAFjNrYvDVj_et9QU9o9pBwN+rnBq-yfbi_O=80cJQYb_htLwRA@mail.gmail.com
обсуждение исходный текст
Ответ на order of (escaped) characters in regex range  (InterRob <rob.marjot@gmail.com>)
Ответы Re: order of (escaped) characters in regex range
Re: order of (escaped) characters in regex range
Re: order of (escaped) characters in regex range
Список pgsql-general


On 13 December 2011 14:04, InterRob <rob.marjot@gmail.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

В списке pgsql-general по дате отправления:

Предыдущее
От: InterRob
Дата:
Сообщение: order of (escaped) characters in regex range
Следующее
От: InterRob
Дата:
Сообщение: Re: order of (escaped) characters in regex range