asinghvi has asked for the wisdom of the Perl Monks concerning the following question:
Perl gurus,
My Regular Expression String is
My Regular Expression String is
where$PAT = '$X =~ s{^(.*?)Resolved (\d+) problems out of (\d+) picked(.*?) +$}{ (($3-$2)/$3>.5) ? 1 : 0 }se';
When I do an eval($PAT); $X correctly gets modified to 1 or 0 depending on the digits in the string. But there is also a newline character appended to the '0' or '1'. What am I doing wrong here. I thought using 's' would let the (.*?) at the beginning and end glob all the newline characters.$X = "Line1\nLine2Resolved 200 problems out of 5000 picked\nLine4\nLin +e5";
Thanks for your help
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: newline behavior in Regular Expression
by fizbin (Chaplain) on Apr 12, 2004 at 19:06 UTC | |
Re: newline behavior in Regular Expression
by cyocum (Curate) on Apr 12, 2004 at 21:00 UTC | |
by qq (Hermit) on Apr 12, 2004 at 21:15 UTC | |
Re: newline behavior in Regular Expression
by halley (Prior) on Apr 12, 2004 at 18:54 UTC | |
by bart (Canon) on Apr 12, 2004 at 19:22 UTC | |
Re: newline behavior in Regular Expression
by Anonymous Monk on Apr 12, 2004 at 18:55 UTC |
Back to
Seekers of Perl Wisdom