Why this regexp matches?! - Mailing list pgsql-general

From hubert depesz lubaczewski
Subject Why this regexp matches?!
Date
Msg-id 20120204084630.GA8183@depesz.com
Whole thread Raw
Responses Re: Why this regexp matches?!
Re: Why this regexp matches?!
List pgsql-general
select 'depesz depeszx depesz' ~ E'^(.*)( \\1)+$';

what's worse:
$ select regexp_replace( 'depesz depeszx depesz', E'^(.*)( \\1)+$', E'\\1' );
 regexp_replace
────────────────
 depesz
(1 row)

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

=$ printf 'depesz depesz depesz\ndepesz depeszx depesz\n' | grep -E '^(.*)( \1)+$';
depesz depesz depesz

Best regards,

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
                                                             http://depesz.com/

pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: debugging the server[ module causes server cash]
Next
From: Szymon Guz
Date:
Subject: Re: Why this regexp matches?!