in reply to Pattern Matching Problem

#!/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!).

Replies are listed 'Best First'.
Re: Pattern Matching Problem
by Abigail-II (Bishop) on Aug 06, 2003 at 13:26 UTC
    That removes the @ signs, of which the OP explicitely mentions they shouldn't be removed.

    Abigail