GNU bug report logs - #18446
A bracket expression with \- not work. grep v 2.14

Previous Next

Package: grep;

Reported by: nezhevenko <nezhevenko <at> protei.ru>

Date: Wed, 10 Sep 2014 15:45:04 UTC

Severity: normal

Tags: notabug

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18446 in the body.
You can then email your comments to 18446 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#18446; Package grep. (Wed, 10 Sep 2014 15:45:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to nezhevenko <nezhevenko <at> protei.ru>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Wed, 10 Sep 2014 15:45:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: nezhevenko <nezhevenko <at> protei.ru>
To: bug-grep <at> gnu.org
Subject: A bracket expression with \- not work. grep v 2.14
Date: Wed, 10 Sep 2014 19:23:29 +0400
[Message part 1 (text/plain, inline)]
Hello!

I know - egrep v 2.14 is not a last version, but i have no time to 
verify in new version :)

Regexp [A\-Z] not work as 'A' or '-' or 'Z'
That finded all letters:

Example:
nezhevenko <at> nezhevenko:~> echo 'd' | grep -E '[A\-Z]'
d
nezhevenko <at> nezhevenko:~> egrep -V
egrep (GNU grep) 2.14
...

-- 
Nezhevenko Nickolay,
Quality Assurance,
Protei LTD,
Saint-Petersburg, Russia.

[Message part 2 (text/html, inline)]

Information forwarded to bug-grep <at> gnu.org:
bug#18446; Package grep. (Wed, 10 Sep 2014 21:06:01 GMT) Full text and rfc822 format available.

Message #8 received at 18446 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: nezhevenko <nezhevenko <at> protei.ru>, 18446 <at> debbugs.gnu.org
Subject: Re: bug#18446: A bracket expression with \- not work. grep v 2.14
Date: Wed, 10 Sep 2014 14:05:22 -0700
On 09/10/2014 08:23 AM, nezhevenko wrote:
> echo 'd' | grep -E '[A\-Z]'
> d 

grep is working correctly here, I'm afraid.  Backslash is not special 
there, so '[A\-Z]' matches 'A' and all characters in the range from '\' 
through 'Z'.  The size of the range depends on the locale; in some 
locales the range is invalid (because '\' sorts after 'Z') but in some 
it's valid and may include 'd', which is what evidently happened for you.

To get the behavior you want, use the pattern '[-AZ]'




Added tag(s) notabug. Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Wed, 10 Sep 2014 21:07:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 18446 <at> debbugs.gnu.org and nezhevenko <nezhevenko <at> protei.ru> Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Wed, 10 Sep 2014 21:07:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 09 Oct 2014 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 253 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.