Tcl Source Code

View Ticket
Login
Ticket UUID: 5ea71fdcd3291c38dff80d6ccdaf30f4969316e4
Title: Regexp fails to enforce LACON restrictions inside nested parentheses
Type: Bug Version: 8.6.4
Submitter: tgl Created on: 2015-11-07 18:31:03
Subsystem: 43. Regexp Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2015-11-07 18:31:03
Resolution: None Closed By: nobody
    Closed on:
Description:
Per the manual, backrefs are not allowed inside lookahead constraints, and all parentheses therein are considered non-capturing.  But the regexp parser forgets these restrictions when it recurses to enter a parenthesized subexpression inside a LACON.  So we get silliness like this (tested with 8.6.4):

% regexp -inline {x(\w)(?=(\1))} {xyz}
xy y
% regexp -inline {x(?=((foo)))} {xfoobar}
x {}

Fix is a one-liner, see attached patch, which is a Tcl-ified version of
http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=a43b4ab1111ca5e5f40a2ddd8e56bf999b9fdad9

Attachments: