|
2001-06-12
| ||
| 15:08 | • Closed ticket [219232ffff]: Error in reporting indices in regexps plus 3 oth... artifact: b33fffb93f user: dkf | |
|
2001-06-10
| ||
| 09:47 | • Ticket [219232ffff]: 5 changes artifact: cbf30efee5 user: dkf | |
|
2000-11-10
| ||
| 17:59 | • Ticket [219232ffff]: 6 changes artifact: de997c584c user: dkf | |
|
2000-10-26
| ||
| 05:03 | • New ticket [219232ffff]. artifact: 4e58fb63a7 user: nobody | |
Error in reporting indices in regexps
Closed / Fixed219232ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 25 years ago
Descriptionplain2000-10-26 05:03:55
OriginalBugID: 4391 Bug
Version: 8.3
SubmitDate: '2000-03-17'
LastModified: '2000-03-29'
Severity: MED
Status: Assigned
Submitter: techsupp
ChangedBy: ericm
OS: Linux
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'
Name:
Laurent Riesterer
ReproducibleScript:
% regexp -nocase -all -inline -- {aa.*?(--(.*?)--|==(.*?)==).*?aa} \ "aa....--match1--........aa,,,,,,,aa....==match2==........aa"
aa....--match1--........aa --match1-- match1 {} aa....==match2==........aa ==match2== {} match2
% regexp -indices -nocase -all -inline -- {aa.*?(--(.*?)--|==(.*?)==).*?aa} \ "aa....--match1--........aa,,,,,,,aa....==match2==........aa"
{0 25} {6 15} {8 13} {-1 -1} {33 58} {39 48} {25 25} {41 46}
%
ObservedBehavior:
the empty submatch in second match reports correctly {} but
indices report {25 25} instead of {-1 -1}
DesiredBehavior:
I should can {-1 -1} for all the empty submatches in all the matches
Verified with 8.3.0 on Linux.
- eric
-- 03/29/2000 ericm
This happens in 8.2.3 as well:
% regexp -indices -start 26 {aa.*(--(.*)--|==(.*)==).*aa} "aa....--match1--........aa,,,,,,,aa....==match2==........aa" a b c d
1
% set a
33 58
% set b
39 48
% set c
25 25
% set d
41 46
Hopefully, Henry can help us out.
- eric
-- 03/29/2000 ericm
dkfplain2000-11-10 17:59:06
It seems to be adding the index of the start of the match area from the second time round to each of the indices that should be -1. The following is a simpler expression of the problem, with a few extra spaces thrown in to distinguish the indices from the first match from those of the second match.
% regexp -indices -inline -all a(b(c)d|e(f)g)h abcdhaefgh
{0 4} {1 3} {2 2} {-1 -1} {5 9} {6 8} {4 4} {7 7}
You could try, as a work-around, excluding all indices that refer to indices prior to the start of the current match area. This is much less than ideal though.
dkfplain2001-06-10 09:47:35
Logged In: YES user_id=79902 Oh, this is actually a fault in tclCmdMZ.c; Tcl_RegexpObjCmd needs to check for non-negative submatch values before adding the offset (lines 372 and 373...)
dkf Closed ticket [219232ffff].
[History diff]2001-06-12 15:08:25
Log in (anonymous is fine) to add a comment.