Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 9dc7b84acc382811c81a1130e8c41e8fa5e011a77e494c74ef66694533ba5356
Ticket: 3d40c2da8175daba83ef373c8b8d9e147744fe4c
regexp (?:a*b)+c indices wrong
User & Date: sebres on 2019-11-24 15:25:35
Changes

  1. closedate changed to: "2458812.14277741"
  2. closer changed to: "sebres"
  3. icomment:
    No.
    
    Although the sub-expression traverses over all <code>a</code> (and finally over all <code>b</code> without <code>a</code>), despite this not capturing it as a group - the whole expression matches all characters to first <code>c</code> inclusive it.
    
    So the result <code>{0 8}</code> is pretty correct - <code>{0..4}</code> <code>aaaab</code> within first iteration by <code>a*b</code>, <code>{5..7}</code> <code>bbb</code> within second to 4th iteration by <code>(a*b)+</code> and then finally <code>{8}</code> <code>c</code>.
    
    Note that <code>(?:a*b)+</code> is neither a lookahead nor a lookbehind assertion (which is not implemented in tcl at all), so the whole match is captured for whole expression.
    
    How the iterations for first subexpression look, illustrating this example:
    <pre>
        % regexp -all -indices -inline {a*b} aaaabbbbcc
        {0 4} {5 5} {6 6} {7 7}
    </pre>
    
  4. login: "sebres"
  5. mimetype: "text/x-fossil-wiki"
  6. resolution changed to: "Invalid"
  7. status changed to: "Closed"