It's negative look ahead assertion time again:
#!/usr/bin/perl -w use strict; while (<DATA>) { s/(.*ing)((?!bob|fred|bill)\w+?)(more)/$1HIT$3/; print $_; } __DATA__ somestringbobmoremore somestringfredmoremore somestringbillmoremore somestringtedmore
Prints:
somestringbobmoremore somestringfredmoremore somestringbillmoremore somestringHITmore
In reply to Re: Negating a regexp
by GrandFather
in thread Negating a regexp
by jxh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |