grep - Bugs: bug #24732, --only-matching prints only...
You are not allowed to post comments on this tracker with your current authentication level.
bug #24732: --only-matching prints only non-overlapping matches in each line
Submitter: | Jeffrey Milloy <jmilloy> | ||
Submitted: | Sun 02 Nov 2008 07:35:25 PM UTC | ||
Votes: | 5 | ||
Category: | None | Severity: | 3 - Normal |
Item Group: | None | Status: | None |
Privacy: | Public | Assigned to: | None |
Open/Closed: | Open |
Sat 21 Sep 2013 05:52:40 AM UTC, comment #3: |
jikszzve <jikszzve> |
Sat 06 Feb 2010 01:30:49 PM UTC, comment #2: maybe leave open, but as a feature reqest. However, with ambiguity like this, it's good to document (and add a test case demonstrating) the intended behavior.
|
Jim Meyering <meyering> |
Sat 06 Feb 2010 01:15:39 PM UTC, comment #1: This is by design, there could be n^2 overlapping matches. Unless I misunderstand I'm inclined to close this. Any other opinions? |
Paolo Bonzini <bonzini> |
Sun 02 Nov 2008 07:35:25 PM UTC, original submission:
Maybe this is more of a feature request, but as I understand the option, --only-matching should print all matches to the pattern in each line.
|
Jeffrey Milloy <jmilloy> |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
There are 5 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follow 2 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2013-01-14 | matthewrussell | Carbon-Copy | - | Added matthewrussell | |
2008-11-02 | jmilloy | Carbon-Copy | - | Added jmilloy |
Powered by Savane 3.13-f8d8.
Corresponding source code
This is a nonissue. You see, in your example the second 0 IS matched by the third period. However, that being said, i do think regular expressions should have a syntax to provide a context for a match while excluding it. But it would have to be more explicit than just using a nonexplicit identifier in the match pattern. I guess you could create a command that would take 3 regular expressions as input.
Another thing about regular expression would be to make them nongreedy by default. Maybe take a look at cgrep.