Re: Why this regexp matches?!

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Why this regexp matches?!
Дата
Msg-id 5F2D84C1-179A-42BA-A5F9-F338B93E8AD7@gmail.com
обсуждение исходный текст
Ответ на Why this regexp matches?!  (hubert depesz lubaczewski <depesz@depesz.com>)
Ответы Re: Why this regexp matches?!  (hubert depesz lubaczewski <depesz@depesz.com>)
Re: Why this regexp matches?!  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On 4 Feb 2012, at 9:46, hubert depesz lubaczewski wrote:

> select 'depesz depeszx depesz' ~ E'^(.*)( \\1)+$';

Peculiar.

It's probably no use to you, but a version where the repetition is expanded (for that particular string) works:

select 'depesz depeszx depesz' ~ E'^(.*)( \\1)( \\1)$';

And this works too:

select 'depesz depeszx depesz' ~ E'^(depesz)( \\1)+$';

Apparently something odd is going on between the wildcard, the repetitive part and the back-reference. That could be
justus not seeing what's wrong with the expression or be an actual bug. 

> I know that Pg regexps are limited, but even grep's regexps match this

Limited? They're really not. According to the docs they are beyond POSIX compliant, even including several extensions
asthey appear in, among others, Perl. That said, the docs do mention a known limitation with braces and
forward-references- maybe this is related. 

Alban Hertroys

--
The scale of a problem often equals the size of an ego.



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: debugging the server[ module causes server cash]
Следующее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: Why this regexp matches?!