If I read the requirement of AM correct, he wants to check for the presence of a $symbol in a $sentence, where the beginning and end of $symbol should also be treated as word boundaries, provided they are word characters.
For this I would propose the following regex (using conditional pattern as suggested by japhy above):
if ($sentence =~ /(?(?=\w)(?:\b))$symbol(?(?<=\w)(?:\b))/) { # do something }
In reply to Re: Regex help
by pKai
in thread Regex help
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |