in reply to On zero-width negative lookahead assertions
First, don't forget to escape @ and ..
>perl -lne "/^root:\s*(?!admin\@somewhere\.here)(.*)/ and print $1" \ aliases.txt firstname.lastname@example.org email@example.com
Note the leading space. When the regexp engine failed using all the spaces, it backtracked to \s* matching all but one space. One way to fix it is to anchor it as follows:
>perl -ne "/^root:\s*(?!admin\@somewhere\.here)\S/ and print;" \ aliases.txt root: firstname.lastname@example.org
|Replies are listed 'Best First'.|
Re^2: On zero-width negative lookahead assertions
by bronto (Priest) on Sep 10, 2004 at 14:37 UTC