Re: Non-capturing expressions - Mailing list pgsql-general

From Francisco Olarte
Subject Re: Non-capturing expressions
Date
Msg-id CA+bJJbzEsMDpveQZ38B7M0ov6L1tkvcAU3aX5f-fW6z+0vtGBQ@mail.gmail.com
Whole thread Raw
In response to Re: Non-capturing expressions  (Thom Brown <thom@linux.com>)
List pgsql-general
Hi Thom:

On Sat, Oct 25, 2014 at 11:55 AM, Thom Brown <thom@linux.com> wrote:
Ah, I knew I missed something:

# SELECT regexp_matches('postgres','(?:g)(r)');
...snip, snip...

Yes. It's one fo the things I strongly dislike of some of the semantics of postgres ( and others ) regular engine functions. Their return value ''semantics''  depends on data, which makes them difficult to use properly when the pattern argument is unknown. I would prefer to have it always return a list with the full match in the first element, the grouped captures behind it ( i.e., {gr} for '(?:g)r', {gr,g} for '(g)r' . But I think it's dessigned more for interactive use with constant patterns than for programmatic use. 
....

I'm familiar with regular expression syntax, just famliarising myself with PostgreSQL's syntax flavour.

 
Sorry, got confused by the question, and by the fact  that I do not know of any regular expression engine with an access function which when presented with non-capturing-group1+unmarked2 returns unmarked2. Even in perl I do not know how to it.


Regards.
  Francisco Olarte.

pgsql-general by date:

Previous
From: Joe Van Dyk
Date:
Subject: pg killed by oom-killer, "invalid contrecord length 2190 at A6C/331AAA90" on slaves
Next
From: sudalai
Date:
Subject: Change recovery configuration without restarting standby_node.