-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
regexp does not set variables #310
Comments
Removing |
Also, repeated submatches are not captured, even with
Note how the whole match includes the repetition, but the capture group doesn't. EDIT: while EDIT: tclsh8.6 behaves the same as jimsh (final match only). That makes sense if EDIT: Per https://regex101.com/ the only other engine that captures repeats and reports them individually is C#. I guess my memory failed me there (I have actually used that scenario in C# before). But, if Is this a distinct issue separate from #310 ? |
I can understand why you might want this, but the general rule for Jim Tcl is to follow the behaviour of Tcl (all else being equal) so I wouldn't be inclined to change this until/unless Tcl does the same. |
Please reopen this. I know the thread text became confusing as I kept researching the issue. But given your reply, that still leaves 3 unresolved issues here:
I believe those fixes fit neatly within the existing doctrine of jimsh. Discussion? I also was going to include these further points below, but actually these below are obviated by not supporting non-capturing groups at all. Capturing groups are the only kind of groups in jimsh; there is no other. So they must support quantifiers greater than 1 for any regex to be viable. So ignore these points below: 3-b) Personally I also think it would be wise to go further, throwing an error on any capturing groups having + or any other quantifier that could result in more than one match, since those are worse than useless, they're actively misleading. Zero matches or one match are OK (as long as I avoided -all) such as ? or {1,1} or {0,1}. But that fix would deviate from tclsh because I doubt it detects that misleading case either. So let's put that fix aside (3-b) and focus on (1) (2) (3) and (4). I believe their fixes fit neatly within the existing doctrine of jimsh. ~~
EDIT: Jim actually does support non-capturing groups since 0.73. So (3-b) and (4) are actually relevant. But functionality in |
To match the documentation and Tcl, if match vars are given with -all, the last match is assigned. Fixes #310 Signed-off-by: Steve Bennett <[email protected]>
OK, I missed that incompatibility. Happy to be compatible with Tcl on this (and match the docs)
See dcea42c |
Tested and works. Even with -indices. Thanks!
On that note, thanks also for |
The text was updated successfully, but these errors were encountered: