[San-Diego-pm] Text substitution
Randal L. Schwartz
merlyn at stonehenge.com
Tue May 2 08:34:19 PDT 2006
>>>>> "Joel" == Joel Fentin <joel at fentin.com> writes:
Joel> Kevin Berggren wrote:
>> What about
>> $Text =~ s/($SearchFor)/<b>$1<\/b>/gi;
Joel> Menolly wrote:
>> Use a backreference:
>> $Text =~ s/($SearchFor)/<b>\1<\/b>/gi;
No. Use $1 in a replacement, not \1. \1 is for backward compatibility, and
fails if you have more than 9 replacement items (\10 is always a control-H).
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
More information about the San-Diego-pm