in reply to Pattern Matching Problem
Seemed like a good spot for look behind and lookahead :-)
___________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 @) /<b>$1<\/b>/xg; # put $1 back with bold tags around it. @ are + preserved. print $test;
|
|---|