Using regex lookahead, egrep

2019-06-14 22:43发布

问题:

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

回答1:

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