#!/usr/bin/perl $_ = 'Patron @FirstName@ @LastName@ has filled out the @FormName@ form. Please send them an email at @EmailAddress@.'; s/@([a-zA-Z]+?)@/\@$1\@<\/b>/g; print $_ . "\n"; # Output: Patron @FirstName@ @LastName@ has filled out the @FormName@ form. Please send them an email at @EmailAddress@.