Robert Hanson wrote:
>
> > ...how to execute a ***multi-line*** match.
> > $_ =~ s/^(M\d+)\n^(.*)/A $1\nB $2/mi;
> > ...i am trying to match the first line, beginning
> > with M followed by consecutive digists...
>
> You are confused about what a "multi-line" match is. A "multi-line" match
> wi
?:^|\n)(M\d+)\n([^\n]*)/A $1\nB $2/si;
> print $_;
>
> Rob
> -Original Message-
> From: M z [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 02, 2002 2:08 PM
> To: Connie Chan
> Cc: [EMAIL PROTECTED]
> Subject: URGENT. Re: multi-line regex question,
> ple
M Z wrote:
>
> Dear all,
Hello,
> I am truly bewildered as to why I can't get this
> script to do what I want. Namely, to get the
> multiline match. Please help see section of code
> surrounded by for question area
>
> sample input:
>
> M0011
> XYZabcdefh
>
> #!C:/perl/bin -w
if I understand
correctly...
$_ = "
M0011
spaceXYZabcdefh
";
$_ =~ s/(?:^|\n)(M\d+)\n([^\n]*)/A $1\nB $2/si;
print $_;
Rob
-Original Message-
From: M z [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 02, 2002 2:08 PM
To: Connie Chan
Cc: [EMAIL PROTECTED]
Subject: URGENT. Re: multi-line rege
> Beside, seems you fotgot to close ; close =)
>
> Smiley Connie =)
>
>
>
> - Original Message -----
> From: "M z" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, July 02, 2002 8:51 AM
> Subject: multi-line regex question, p
On Monday, July 1, 2002, at 05:51 , M z wrote:
> sample input:
>
> M0011
> XYZabcdefh
[..]
> while () {
> s/^ +//gi;
> ###below, I think I count for M0011 in $1
> ###then, i thought by using the /m modifier,
> ###i could but a caret after the \n
> ###this doesn't work for me, please help
>
AM
Subject: multi-line regex question, please help!
> Dear all,
>
> I am truly bewildered as to why I can't get this
> script to do what I want. Namely, to get the
> multiline match. Please help see section of code
> surrounded by for question area
>
>
Dear all,
I am truly bewildered as to why I can't get this
script to do what I want. Namely, to get the
multiline match. Please help see section of code
surrounded by for question area
sample input:
M0011
XYZabcdefh
#!C:/perl/bin -w
die "Usage perl qup.pl " unless @ARGV
==