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.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#23676: closed (Seems egrep violates simple rules of regexps)
Date: Wed, 01 Jun 2016 19:48:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 1 Jun 2016 12:47:41 -0700
with message-id <01bacb3c-4fce-b0f7-24d7-9b6bdd6847ac <at> cs.ucla.edu>
and subject line Re: bug#23676: Seems egrep violates simple rules of regexps
has caused the debbugs.gnu.org bug report #23676,
regarding Seems egrep violates simple rules of regexps
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
23676: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23676
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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


[Message part 3 (message/rfc822, inline)]
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


This bug report was last modified 9 years and 52 days ago.

Previous Next


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