Re: Non-capturing expressions

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: Thom Brown <thom(at)linux(dot)com>
Cc: PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Non-capturing expressions
Date: 2014-10-26 07:50:40
Message-ID: CA+bJJbzEsMDpveQZ38B7M0ov6L1tkvcAU3aX5f-fW6z+0vtGBQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Thom:

On Sat, Oct 25, 2014 at 11:55 AM, Thom Brown <thom(at)linux(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message nurul [via PostgreSQL] 2014-10-27 04:46:48 Re: Log-shipping replication in one machine
Previous Message Joe Van Dyk 2014-10-25 20:55:57 pg killed by oom-killer, "invalid contrecord length 2190 at A6C/331AAA90" on slaves