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.