use Regex::PreSuf; my $re = presuf(@SearchTexts); s!(\b$re\b)!$1!ig;