in reply to Can I Use Variables In A Regex?
The 'e' is required to treat the replacement as Perl code and not a literal string. You don't want the \b's in the replacement because the replacement isn't a regex - it's normally a literal string. You can chain 'e' so that the first evaluation would produce Perl code that would, itself, be evaluated.
This is all explained in the relevant page at http://perldoc.perl.org. (Scroll down a bit to find the s/// section.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can I Use Variables In A Regex?
by dave_the_m (Monsignor) on Oct 30, 2005 at 10:28 UTC |