The substitution part of s/// is not a regular expresssion, so it doesn't make much sense to put \W+ in there. Just remove it:
$str =~ s/$query\W+/<em>$query<\/em> /ig;
In reply to Re: How to use \W in Regular Expression?
by almut
in thread How to use \W in Regular Expression?
by Sachin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |