# using boundaries s//#foo foo foobar foo#/; s/\bfoo\b//g; print; # using negative lookahead and lookbehind assertions s//#foo foo foobar foo#/; s/(?