Re: Why this regexp matches?!

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why this regexp matches?!
Date: 2012-02-06 11:48:53
Message-ID: 20120206114853.GA13214@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Feb 06, 2012 at 11:29:23AM +0000, Jasen Betts wrote:
> On 2012-02-04, hubert depesz lubaczewski <depesz(at)depesz(dot)com> wrote:
> > 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:
>
> whose grep?
>
> Postgres is BSD licence and that means they can't use the latest and
> greatest GPL libraries.

yes, I did use gnu grep. but it's hardly "latest and greatest" - there
is nothing very special about this regexp, aside from the fact, that
according to pg docs (how I read them) - it shouldn't match, but it
does.

depesz

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pat Heuvel 2012-02-06 12:18:55 Re: vacuumlo fails pgsql ver 8.3
Previous Message Jasen Betts 2012-02-06 11:29:23 Re: Why this regexp matches?!