Re: Regular expression question with Postgres

Поиск
Список
Период
Сортировка
От David G Johnston
Тема Re: Regular expression question with Postgres
Дата
Msg-id 1406234536911-5812778.post@n5.nabble.com
обсуждение исходный текст
Ответ на Regular expression question with Postgres  (Mike Christensen <mike@kitchenpc.com>)
Ответы Re: Regular expression question with Postgres  (Mike Christensen <mike@kitchenpc.com>)
Список pgsql-general
Mike Christensen-2 wrote
> I'm curious why this query returns 0:
>
> SELECT 'AAA' ~ '^A{,4}$'
>
> Yet, this query returns 1:
>
> SELECT 'AAA' ~ '^A{0,4}$'
>
> Is this a bug with the regular expression engine?

Apparently since "{,#}" is not a valid regexp expression the engine simply
interprets it as a literal and says 'AAA' != 'A{,4}'

http://www.postgresql.org/docs/9.3/interactive/functions-matching.html#FUNCTIONS-POSIX-REGEXP

Table 9-13. Regular Expression Quantifiers

Note the all of the { } expressions have a lower bound (whether explicit or
implied).

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Regular-expression-question-with-Postgres-tp5812777p5812778.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


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

Предыдущее
От: Mike Christensen
Дата:
Сообщение: Regular expression question with Postgres
Следующее
От: Mike Christensen
Дата:
Сообщение: Re: Regular expression question with Postgres