in reply to Matching problems
Try
The backreference (\1) preserves case.my $search = "this"; my $data = "This is the test text for THIS routine."; my $bs = "<b>"; my $be = "</b>"; my $count = $data =~ s/\b($search)\b/$bs\1$be/gi;
Update: Kanji is right. Use $1 instead of \1.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Matching problems
by Kanji (Parson) on Apr 20, 2002 at 00:17 UTC | |
|
Re: Re: Matching problems
by Anonymous Monk on Apr 20, 2002 at 04:22 UTC |