User Comments: |
sebres added on 2019-11-24 15:25:35:
(text/x-fossil-wiki)
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>
|