Using regex lookahead, egrep

James Raitsev picture James Raitsev · May 18, 2012 · Viewed 13.7k times · Source

If your file contains

apples are good
apple cider is also good

Why would egrep '(?=apples)app' file fail to pick up any lines?

Using egrep 2.5.1 on MAC

Answer

Prince John Wesley picture Prince John Wesley · May 18, 2012

Extended regular expression doesn't have positive look-ahead feature. See the regex flavor comparison