Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 604d5fefe359a014d1247a05afcfbb2b8e57f743
Ticket: 3604074fffffffffffffffffffffffffffffffff
Inifinite loop when matching regular expression
User & Date: sebres on 2013-02-11 22:40:33
Changes

  1. icomment:
    Maybe just throw an error here, like python?
    # re.match('((a)*)', 'a').groups()
    ('a', 'a')
    # re.match('((a)*)*', 'a').groups()
    raise error, v # invalid expression
    error: nothing to repeat
    
    >[dkf] switch to a different RE engine
    I see a big compatibility problem here - many RE engines are incompatible to TCL RE.
    For example (python, java etc.) follow by "OR"-expression a "boolean" rules "first wins" instead of "hungry - large wins":
    [python]
    # re.match('(ab|abc)(cd|d)', 'abcd').groups()
    ('ab', 'cd')
    [tcl]
    % regexp -inline {(ab|abc)(cd|d)} abcd
    abcd abc d
    
    or see 3574242 for example (I do not know whether this is a bug):
    
    [tcl]
    % regexp -inline {((?:ab|abc){1}?)(cd|d){1}?} abcd
    abcd abc d
    % regexp -inline {((?:ab|abc){1,1}?)(cd|d){1,1}?} abcd
    abcd ab cd
    [python]
    # re.match('((?:ab|abc){1}?)(cd|d){1}?', 'abcd').groups()
    ('ab', 'cd')
    # re.match('((?:ab|abc){1,1}?)(cd|d){1,1}?', 'abcd').groups()
    ('ab', 'cd')
    
    Maybe is it possible to outsource RE engine in to a separate module, like python RE (to let user a choice) - something like this:
    reguse standard|extended|...
    
    
    
  2. login: "sebres"
  3. mimetype: "text/plain"
  4. username: "sebres"