for my $string (@strings) { $input =~ s/\[\Q$string\E\]/__[username]__[$string]__/; }