in reply to trouble with @ in a regular expression
perl -e "my $str='foo@bar'; if ($str =~ /@/){ print \"No need to escap +e the \@ in a regex\";}" No need to escape the @ in a regex
or, more nearly parallel to your problem statement, anchoring the start of the line:
perl -e "my $str='@bar'; if ($str =~ /^@/){ print \"No need to escape +the \@ in a regex\";}" No need to escape the @ in a regex
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: trouble with @ in a regular expression
by AnomalousMonk (Archbishop) on Mar 29, 2012 at 23:16 UTC | |
by ww (Archbishop) on Mar 30, 2012 at 12:30 UTC | |
by AnomalousMonk (Archbishop) on Mar 30, 2012 at 12:57 UTC |