regexp_matches() quantified-capturing-parentheses oddity

From: Julian Mehnle <julian(at)mehnle(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: regexp_matches() quantified-capturing-parentheses oddity
Date: 2009-12-08 16:03:07
Message-ID: 200912081603.13076.julian@mehnle.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

wisu-dev=# SELECT regexp_matches('quux(at)foo@bar.zip', '([(at)(dot)]|[^(at)(dot)]+)', 'g');
{quux}
{(at)}
{foo}
{(at)}
{bar}
{.}
{zip}

So far, so good. However, can someone please explain the following to me?

wisu-dev=# SELECT regexp_matches('quux(at)foo@bar.zip', '([(at)(dot)]|[^(at)(dot)]+)+', 'g');
{p}

wisu-dev=# SELECT regexp_matches('quux(at)foo@bar.zip', '([(at)(dot)]|[^(at)(dot)]+){1,2}', 'g');
{(at)}
{(at)}
{.}
{p}

wisu-dev=# SELECT regexp_matches('quux(at)foo@bar.zip', '([(at)(dot)]|[^(at)(dot)]+){1,3}', 'g');
{foo}
{.}
{p}

What's going on here??

Regards,

-Julian Mehnle

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gauthier, Dave 2009-12-08 16:11:32 how to allow a sysid to be a superuser?
Previous Message Glyn Astill 2009-12-08 16:03:05 Re: LDAP configuration changes in 8.4?