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.
In reply to Re: Matching problems
by dws
in thread Matching problems
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |