use Regexp::Common qw( URI ); $message =~ s#^($RE{URI}{HTTP})#$1#; $message =~ s#(?<=\s)($RE{URI}{HTTP})#$1#g;