Take the 2-minute tour ×  I'm trying to play around w/ a
negative lookbehind regex, but I can't seem to get it to work in
my zshell. Am I doing this wrong?  echo "Nate or nate" | grep
"(\?<!N)a"  This should match the a in nate but NOT the a in
Nate...right?  share|improve this question zsh or bash it's the
same thing. But good question and accepted answer –  zzapper Jul
18 at 15:33  4 Answers 4  up vote 6 down vote accepted  When I
think of lookahead or lookbehind assertions, I think of Perl.
You will need to use perl-regexp and single quotes to find the a
in nate:  echo "Nate or nate" | grep -P '(?<!N)a' share|improve
this answer bash: !grep: event not found –  Cerin Jan 7 '13 at
21:57 @Cerin: You will need GNU grep. I'd say your flavor
doesn't support Perl-regex. –  Steve Jan 7 '13 at 23:43 I had
the same problem today and your answer was the only one that
worked (in bash, actually ...). Does lookahead/lookbehind not
work at all (without PCRE) or do I just have to escape
particular characters to make it wo