Re: Backslash Bug in ARE Class-Shorthand Escape?

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Backslash Bug in ARE Class-Shorthand Escape?
Дата
Msg-id 3FD19020.6020407@joeconway.com
обсуждение исходный текст
Ответ на Backslash Bug in ARE Class-Shorthand Escape?  (david@fetter.org (David Fetter))
Ответы Re: Backslash Bug in ARE Class-Shorthand Escape?  (Joe Conway <mail@joeconway.com>)
Список pgsql-bugs
David Fetter wrote:
> I have a little puzzlement.  In the first select, I double the
> backslash and return true.  In the second, I don't and get false.
> Have I missed something important in the docs?

I don't know if it is clear in the docs anywhere wrt regex, but the
string literal parser will consume one layer of backslashes on you. So
in your first case '\\d' is fed into the regex matching function as '\d'
(string literal parser sees \\ == escape \ == \), and in the second case
'\d' is fed in as 'd' (string literal parser sees \d == escape d == d).
The basic rule at work here is you need to double up all backslashes.

HTH,

Joe

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

Предыдущее
От: david@fetter.org (David Fetter)
Дата:
Сообщение: Backslash Bug in ARE Class-Shorthand Escape?
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Backslash Bug in ARE Class-Shorthand Escape?