Modified regex to accomodate bil:
#!/usr/bin/perl -w use strict; while (<DATA>) { s/(.*ing)((?!bob|fred|bill(?!ess))\w+?)(more|less)/$1HIT$3/; print $_; } __DATA__ somestringbobmoremore somestringfredmoremore somestringbillmoremore somestringtedmore somestringbilless
Prints:
somestringbobmoremore somestringfredmoremore somestringbillmoremore somestringHITmore somestringHITless
In reply to Re^3: Negating a regexp
by GrandFather
in thread Negating a regexp
by jxh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |