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: Марк Коренберг
 <socketpair <at> gmail.com>
Subject: bug#23676: closed (Re: bug#23676: Seems egrep violates simple
 rules of regexps)
Date: Wed, 01 Jun 2016 19:48:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#23676: Seems egrep violates simple rules of regexps

which was filed against the grep package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 23676 <at> debbugs.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: 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

[Message part 3 (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



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

Previous Next


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