#!/usr/bin/perl $_ = 'Patron @FirstName@ @LastName@ has filled out the @FormName@ form +. Please send them an email at @EmailAddress@.'; s/@([a-zA-Z]+?)@/<b>\@$1\@<\/b>/g; print $_ . "\n"; # Output: Patron <b>@FirstName@</b> <b>@LastName@</b> has filled out t +he <b>@FormName@</b> form. Please send them an email at <b>@EmailAddr +ess@</b>.
This gets the right output with the sample data you gave. I hope it helps you along.
--
Allolex
Update 2003-08-06 15:28:15 CEST: Fixed substitution problem pointed out by Abigail-II (Thanks!).
In reply to Re: Pattern Matching Problem
by allolex
in thread Pattern Matching Problem
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |