J
jwcarlton
I'm trying to find and replace any non-alphanumeric character (or lack
thereof), followed by a specified word, followed by any other non-
alphanumeric character (or lack thereof).
Here's where I am so far, using "jason" as the specified word:
$comment =~ s/(\W)jason(\W)/$1*****$2/i;
Specifically, I want to catch things like " Jason" (notice the opening
whitespace), "<br>Jason!", "***Jason***", and "<br>Jason\n". I'm not
so concerned about underscores, which I understand aren't included in
\W.
Any suggestions?
thereof), followed by a specified word, followed by any other non-
alphanumeric character (or lack thereof).
Here's where I am so far, using "jason" as the specified word:
$comment =~ s/(\W)jason(\W)/$1*****$2/i;
Specifically, I want to catch things like " Jason" (notice the opening
whitespace), "<br>Jason!", "***Jason***", and "<br>Jason\n". I'm not
so concerned about underscores, which I understand aren't included in
\W.
Any suggestions?