my $test = 'Patron @FirstName@ @LastName@ has filled out the @FormName@ form. Please send them an email at @EmailAddress@.'; $test =~ s/(?<=@) # starts with @ (but don't grab @) ([a-zA-Z]*) # string of letters (?=@) # ends with @ (but don't grab @) /$1<\/b>/xg; # put $1 back with bold tags around it. @ are preserved. print $test;