bug#23676: Seems egrep violates simple rules of regexps

2016-06-01 Thread Paul Eggert
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#23676: Seems egrep violates simple rules of regexps

2016-06-01 Thread Марк Коренберг
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