On Monday, July 1, 2002, at 05:51 , M z wrote:
> sample input:
>
> M0011
> XYZabcdefh
[..]
> while (<I>) {
> 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
> ########
> $_ =~ s/^(M\d+)\n^(.*)/A $1\nB $2/mi;
> ########
> print O "$_";
>
>
> }
you have two basic problems here -
a) while(<I>) {....}
reads a line at a time - hence to the EOL
and hence you will not find that as a part of the pattern space
with the "\n"
b) your 'input file' seems to be "squirrelly" - to begin with...
{ hence why you are trying to fix it this way.... - but
you may want to deal with the problem of not re-inventing
a hard to parse file.... }
you might want something like:
http://www.wetware.com/drieux/pbl/RegEx/multiLineRegEx.txt
note - I use Inline::File to make that play work.... saves
on having to write a file...
also you will not the qr/.../ox trick so I can break out
the documentation about what we are trying to find.
HTH
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]