Skip to content
Tcl Source Code History Of Ticket 5ea71fdcd3
Login

History Of Ticket 5ea71fdcd3

Artifacts Associated With Ticket 5ea71fdcd3

  1. Ticket change [563771520a] (rid 143838) by tgl on 2015-11-07 18:31:03:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      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
      
    5. foundin initialized to: "8.6.4"
    6. is_private initialized to: "0"
    7. login: "tgl"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "26864b65f1c6ce8bda86f87ed9c554e19ac0390d"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "tgl"
    14. subsystem initialized to: "43. Regexp"
    15. title initialized to:
      Regexp fails to enforce LACON restrictions inside nested parentheses
      
    16. type initialized to: "Bug"
  2. Add attachment "laconfix.patch" [19036eb915] (rid 143839) by tgl on 2015-11-07 18:31:39.

  3. Ticket change [7a42f695cd] (rid 257569) by serhiy.storchaka on 2026-10-11 08:04:06:

    1. foundin changed to: "8.6.18, 9.0.5, 9.1.0"
    2. icomment:
      Still the same in 8.6, 9.0 and 9.1.
      
      Proposed fix in branch [/timeline?r=regexp-lacon-nested-parens|regexp-lacon-nested-parens]: your patch. Both examples now behave as in PostgreSQL: the first one gives "invalid backreference number", the second one matches <tt>x</tt> without submatches. Tests reg-6.21 to 6.24.
      
      <b>This is a breaking change.</b> Parentheses nested in a lookahead constraint no longer count as capturing, so the following subexpressions are renumbered, and REs with a backref inside a lookahead constraint no longer compile. Both are what re_syntax.n has always documented, but existing code may rely on the old behaviour. Code that used non-capturing groups <tt>(?:...)</tt> inside lookahead constraints, the workaround for this bug, is not affected.
      
    3. login: "serhiy.storchaka"
    4. mimetype: "text/x-fossil-wiki"