emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with recent change to grep-regexp-alist


From: Stefan Monnier
Subject: Re: problem with recent change to grep-regexp-alist
Date: Tue, 09 Aug 2005 19:57:17 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin)

>> In the 1.42 revision of grep.el the subpattern for the filename in the
>> regexps of the first two grep-regexp-alist's elements has been changed
>> from "\(.+?\)" to "\([^:\n]+\)". Now the matching fails if the
>> filename contains a colon, while the previous value worked, thanks to the
>> non greedy "+?" quantifier. Note that the regexp of the third
>> grep-regexp-alist's element is still correct, and is the one that
>> matches if grep-highlight-matches's value is "t" (which is the
>> default).

> Ok, let's use "\(.+?\)".

> You can still get wrong matches with the file names like "abc:123",
> but perhaps such file names are rare.

It doesn't matter whether they're rare or not: they result in ambiguous
output from grep, so in such cases Emacs can't be sure to get it right.
I.e. the .+? regexp is as good as it gets: when it's not ambiguous it works
right, and when it's ambiguous it chooses one of the possibilities
"arbitrarily".


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]