jrpfinch wrote:
I would like to execute the following regex on a file:

s/(\$Revision:\s+)(\d+\.\d+)(\s+\$.+use constant VERSION\s+=> ")(.+?)
(")/$1$2$3Revision $2$5/gs

I am doing this in bash as follows:

REGEX='s/(\$Revision:\s+)(\d+\.\d+)(\s+\$.+use constant VERSION\s+=> ")
(.+?)(")/$1$2$3Revision $2$5/gs'
REGEX="'"$REGEX"'"
perl -p0777 -e $REGEX mmScheduler.pl > mmScheduler.ed

Unfortunately I am getting the error and can't seem to find the source
of it after a few experiments:

Can't find string terminator "'" anywhere before EOF at -e line 1.

Any advice gratefully received.

Doesn't work here either.   :-)

$ REGEX='s/(\$Revision:\s+)(\d+\.\d+)(\s+\$.+use constant VERSION\s+=> ")(.+?)(")/$1$2$3Revision $2$5/gs'
$ REGEX="'"$REGEX"'"
$ perl -MO=Deparse -pe $REGEX
LINE: while (defined($_ = <ARGV>)) {
    '???';
}
continue {
    print $_;
}
-e syntax OK



Here is what you need to do:

$ REGEX=' s/(\$Revision:\s+)(\d+\.\d+)(\s+\$.+use constant VERSION\s+=> ")(.+?)(")/$1$2$3Revision $2$5/gs '
$ perl -MO=Deparse -pe $REGEX
LINE: while (defined($_ = <ARGV>)) {
s/(\$Revision:\s+)(\d+\.\d+)(\s+\$.+use constant VERSION\s+=> ")(.+?)(")/$1$2$3Revision $2$5/gs;
}
continue {
    print $_;
}
-e syntax OK




John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to