bug-grep
[Top][All Lists]
Advanced

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

bug#39678: 'grep --ignore-case --color' does not always color the matche


From: Benno Schulenberg
Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches
Date: Wed, 19 Feb 2020 11:18:18 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

  echo a | grep -i --color '\a'

  echo a | grep -i --color '\A'

Of the above two commands, only the second colorizes the printed "a".

(An old GNU grep on NetBSD (grep 2.5.1a nb1) does the opposite of
a modern grep: it will show color for \a, but none for \A.)

Bug was found in GNU grep 3.1 while checking whether it understands
\d as a shorthand for [0-9].  Still present in 3.4. The locale does
not appear to matter.


In a report against glibc [1] that seems to be related, a comment
says that "Unknown backslash escapes invoke undefined behaviour."
But where in the documentation does it say so?


When searching for a regular expression in GNU nano (^W M-R), nano says
it cannot find any \a.  But for \A, it will find all "a"s and "A"s.
Nano's default search is case insensitive.  See [2] for the original
report by Ben Addis.  I suppose this is the same or a related bug in
the regex module of gnulib, which nano uses.


[1] https://sourceware.org/bugzilla/show_bug.cgi?id=22425

[2] https://savannah.gnu.org/bugs/?57852

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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