regexp_matches() quantified-capturing-parentheses oddity - Mailing list pgsql-general

From Julian Mehnle
Subject regexp_matches() quantified-capturing-parentheses oddity
Date
Msg-id 200912081603.13076.julian@mehnle.net
Whole thread Raw
Responses Re: regexp_matches() quantified-capturing-parentheses oddity  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi all,

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

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

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

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

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

What's going on here??

Regards,

-Julian Mehnle

Attachment

pgsql-general by date:

Previous
From: Glyn Astill
Date:
Subject: Re: LDAP configuration changes in 8.4?
Next
From: "Gauthier, Dave"
Date:
Subject: how to allow a sysid to be a superuser?