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 via email to