L
laredotornado
Hi,
I'm using Perl 5.10.6 on Mac 10.6.6. I want to execute a simple
search and replace against a file ...
my $searchAndReplaceCmd = "perl -pi -e 's/\\Q${localTestDir}\\E//g' $
{testSuiteFile}";
system( $searchAndReplaceCmd );
but the problem above is the variable $localTestDir contains directory
separators, and this screws up the regular expression ...
Bareword found where operator expected at -e line 1, near "s/\Q/home/
selenium"
Backslash found where operator expected at -e line 1, near "Live\"
syntax error at -e line 1, near "s/\Q/home/selenium"
Search pattern not terminated at -e line 1.
How do I do a search and replace when the variable in questions
contains regular expression characters? Thanks, - Dave
I'm using Perl 5.10.6 on Mac 10.6.6. I want to execute a simple
search and replace against a file ...
my $searchAndReplaceCmd = "perl -pi -e 's/\\Q${localTestDir}\\E//g' $
{testSuiteFile}";
system( $searchAndReplaceCmd );
but the problem above is the variable $localTestDir contains directory
separators, and this screws up the regular expression ...
Bareword found where operator expected at -e line 1, near "s/\Q/home/
selenium"
Backslash found where operator expected at -e line 1, near "Live\"
syntax error at -e line 1, near "s/\Q/home/selenium"
Search pattern not terminated at -e line 1.
How do I do a search and replace when the variable in questions
contains regular expression characters? Thanks, - Dave