Artifacts Associated With Ticket 2826551
Ticket change [0ad9565c2a] (rid 113891) by lars_h on 2009-07-24 12:53:45:
- assignee initialized to: "pvgoran"
- cmimetype initialized to: "text/plain"
- comment initialized to:
I was going to use [regexp -all -inline] to split a unified diff into chunks, but found that this would skip every second chunk. This seems to be related to ^ not matching the beginning of line if the newline is before the -start position. SMALL EXAMPLE: set data { @1 2 +3 @4 -5 +6 7 @8 9 } regexp -all -inline {(?n)^@.*\n(?:[^@].*\n?)*} $data RETURNS {@1 2 +3 } {@8 9 } RATHER THAN {@1 2 +3 } {@4 -5 +6 7 } {@8 9 } EXPLANATION: A diff chunk consists of one header line beginning with @, followed by a body consisting of lines not beginning with @ (but rather space, plus, or minus). The header line is thus in line-sensitive mode matched by ^@.* and a body line is matched by ^[^@].*, so a sensible combined regexp is (?n)^@.*\n(?:[^@].*\n?)* Each chunk is indeed matched by this, but when -all is used, only every second chunk is found. In this case, dropping the ^ from the regexp allows all chunks to be found: % regexp -all -inline {(?n)@.*\n(?:[^@].*\n?)*} $data {@1 2 +3 } {@4 -5 +6 7 } {@8 9 } This suggests the problem may be that ^ fails to match when at the -start position, as one obvious way to implement [regexp -all] is as the equivalent of a loop around [regexp -start]. Indeed, % regexp -start 1 -indices {(?n)^a} "\nab" match 0 % regexp -start 0 -indices {(?n)^a} "\nab" match 1 % set match 1 1 - foundin initialized to: "obsolete: 8.6b1"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "lars_h"
- subsystem initialized to: "43. Regexp"
- title initialized to: "Line-sensitivity at -start, but also -all"
- type initialized to: "Bug"
Ticket change [ca87afa673] (rid 95364) by jkock on 2009-10-16 05:25:56:
- icomment:
Here is another description of the bug, and a contrast: In regexp with the -all option, it is clear that the matches must not overlap. But how is the rule if the expression starts with a constraint (width zero), like for example ^ or \m ? To my surprise you cannot find a linestart after a matched \n: % regexp -all -inline -indices {(?n)^a\n} "a\na\na\n" {0 1} {4 5} The behaviour I expected is the one seen with \m instead of ^: you _can_ find a wordstart after a matched \n: % regexp -all -inline -indices {(?n)\ma\n} "a\na\na\n" {0 1} {2 3} {4 5} So somehow the regexp engine is allowed to look back to see that a \n preceded and hence constitutes a word boundary, but it is not allowed to look back and detect that this same \n also constitutes a line boundary... - login: "jkock"
- mimetype: "text/plain"
- username: "jkock"
- icomment:
Ticket change [b0a888e561] (rid 98024) by mdejong on 2010-02-09 18:28:48:
- icomment:
Added patch 2948425 to addres this issue.
- login: "mdejong"
- mimetype: "text/plain"
- username: "mdejong"
- icomment:
Ticket change [278f3026ba] (rid 88539) by dkf on 2010-02-11 18:15:48:
- icomment:
That patch now applied.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [fdd0a1e2bf] (rid 108483) by dgp on 2010-08-09 23:23:45:
- icomment:
status? This bug is/was 8.6 branch only? Or is there still a need to fix a bug for new 8.5.* releases too?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [8bafbc1947] (rid 127608) by dgp on 2010-08-10 00:54:31:
- priority changed to: "9 Immediate"
Ticket change [9e4bffb7f1] (rid 96452) by lars_h on 2010-08-12 04:20:26:
- icomment:
To answer dgp's question: the bug was originally encountered under 8.5 (possibly even 8.4), so a fix there would be nice too. Given how little tends to change in the regexp engine, I would be surprised if fixing 8.5 is different from fixing 8.6.
- login: "lars_h"
- mimetype: "text/plain"
- username: "lars_h"
- icomment:
Ticket change [0535067d9e] (rid 89017) by dkf on 2010-08-12 15:56:35:
- assignee changed to: "dkf"
- closedate changed to: "2010-08-12T08:56:35"
- closer changed to: "dkf"
- icomment:
allow_comments - 1 Backported patch to 8.5.
- login: "dkf"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "dkf"