Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 73755bb48fc6ecde7e5fd617647e1a1e6e99ab79
Ticket: 6585b21ca8fa6f3678d442b97241fdd43dba2ec0
Non-greedy match fails in combination with backreference
User & Date: anonymous on 2013-07-18 23:03:22
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    This regexp test fails, though it should succeed:
    
    % regexp {(\w).*?\1} {Programmer}
    0
    
    If you remove the '?', it does succeed, showing that the problem is restricted to non-greedy mode.
    
    This problem was initially reported to the Postgres project:
    http://www.postgresql.org/message-id/CAM2+6=U8CdfM-qL55XHt+7hVzDRBnZwrHiVZRX2shGZ4OMuMSQ@mail.gmail.com
    
    As per the discussion there, it seems that this is a bug in cfindloop(), and that the fix is that the /* no point in trying again */ code block is wrong and should be replaced by a simple "break;", allowing the intermediate loop to continue iterating with the next possible "begin" value.  I further suggested refactoring to merge that test into the subsequent statements that adjust estart/estop, but that's cosmetic, not essential to the fix.
    
  5. foundin changed to: "8.5.8"
  6. is_private changed to: "0"
  7. login: "anonymous"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "26864b65f1c6ce8bda86f87ed9c554e19ac0390d"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "anonymous"
  14. subsystem changed to: "43. Regexp"
  15. title changed to:
    Non-greedy match fails in combination with backreference
    
  16. type changed to: "Bug"