GNU bug report logs - #23676
Seems egrep violates simple rules of regexps

Previous Next

Package: grep;

Reported by: Марк Коренберг <socketpair <at> gmail.com>

Date: Wed, 1 Jun 2016 19:35:02 UTC

Severity: normal

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 23676 in the body.
You can then email your comments to 23676 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#23676; Package grep. (Wed, 01 Jun 2016 19:35:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Марк Коренберг <socketpair <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Wed, 01 Jun 2016 19:35:02 GMT) Full text and rfc822 format available.

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

From: Марк Коренберг <socketpair <at> gmail.com>
To: bug-grep <at> gnu.org
Subject: Seems egrep violates simple rules of regexps
Date: Thu, 2 Jun 2016 00:33:54 +0500
Example:

$ echo qwerty | egrep -o 'we|wert'
wert
$ echo qwerty | egrep -o 'wert|we'
wert

The same in Javascript:

/we|wert/.exec('qwerty')
["we"]
/wert|we/.exec('qwerty')
["wert"]

http://stackoverflow.com/questions/2394931/regex-is-behaving-lazy-should-be-greedy

$ egrep --version
grep (GNU grep) 2.25


-- 
Segmentation fault




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Wed, 01 Jun 2016 19:48:01 GMT) Full text and rfc822 format available.

Notification sent to Марк Коренберг <socketpair <at> gmail.com>:
bug acknowledged by developer. (Wed, 01 Jun 2016 19:48:02 GMT) Full text and rfc822 format available.

Message #10 received at 23676-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Марк Коренберг <socketpair <at> gmail.com>,
 23676-done <at> debbugs.gnu.org
Subject: Re: bug#23676: Seems egrep violates simple rules of regexps
Date: Wed, 1 Jun 2016 12:47:41 -0700
On 06/01/2016 12:33 PM, Марк Коренберг wrote:
> Example:
>
> $ echo qwerty | egrep -o 'we|wert'
> wert
> $ echo qwerty | egrep -o 'wert|we'
> wert

That's not a bug; it's a feature. See, for example:

https://swtch.com/~rsc/regexp/regexp1.html




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

This bug report was last modified 8 years and 362 days ago.

Previous Next


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