in reply to How to use \W in Regular Expression?
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to use \W in Regular Expression?
by Sachin (Acolyte) on Dec 30, 2009 at 12:14 UTC | |
by almut (Canon) on Dec 30, 2009 at 12:17 UTC | |
by Sachin (Acolyte) on Dec 30, 2009 at 12:31 UTC | |
by ikegami (Patriarch) on Dec 30, 2009 at 12:37 UTC | |
by almut (Canon) on Dec 30, 2009 at 12:36 UTC | |
by AnomalousMonk (Archbishop) on Dec 30, 2009 at 13:10 UTC | |
by ikegami (Patriarch) on Dec 30, 2009 at 14:25 UTC | |
|