Subject: Seems egrep violates simple rules of regexps

From: Марк Коренберг <[email-masked]>
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