> On Aug 9, 2021, at 6:11 PM, Tom Lane <t...@sss.pgh.pa.us> wrote:
> 
> Hm.  I'm not sure that this example proves anything about Perl's handling
> of the situation, since you didn't use a backref.

Well, this doesn't die either:

if ('foo' =~ m/((??{ die; })(.)(??{ die $1; })){0}((??{ die "got here"; })|\2)/)
{
    print "matched\n";
}

The point is that the regex engine never walks the part of the pattern that {0} 
qualifies.  I thought it was more clear in the prior example, because that 
example proves that the engine does get as far as capturing.  This example also 
does that, and with a backref, because it dies with "got here".
 
—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company





Reply via email to