tomazos has asked for the wisdom of the Perl Monks concerning the following question:
my $foo = '$@!#@#$^$#@^';
..and I want to incorporate it into a regular expression such that the characters of the string will be matched literally, no matter what characters they are.
ie
my $bigfoo='aabbaaa$@!#@#$^$#@^bbabaaba'; assert $bigfoo =~ /(a|b)*$foo(a|b)*/;
What is the correct way to interpolate a string literal into a regular expression?
Thanks,
-Andrew.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using string literal in regexp
by davorg (Chancellor) on Jun 16, 2006 at 15:55 UTC | |
|
Re: Using string literal in regexp
by sh1tn (Priest) on Jun 16, 2006 at 17:43 UTC | |
by chromatic (Archbishop) on Jun 17, 2006 at 07:32 UTC |