#!/usr/bin/perl -w use strict; while () { s/(.*ing)((?!bob|fred|bill)\w+?)(more|less)/$1HIT$3/; print $_; } __DATA__ somestringbilless