in reply to Re: parsing with regex
in thread parsing with regex

Sorry, I probably wasn't clear enough.
I would need everything between the horizontal breaks which would be:
1 is good<BR> data unique to 1<BR> data unique to 1<<BR> data unique to 1<<BR> data unique to 1<<BR> 3 is good<BR> data unique to 3<<BR> data unique to 3<<BR> data unique to 3<<BR> data unique to 3<<BR>
Thank you,
2501

Replies are listed 'Best First'.
Re: Re: Re: parsing with regex
by Sifmole (Chaplain) on Nov 16, 2001 at 18:39 UTC
    Okay how about this?
    #!/usr/bin/perl -w use strict; my @foo; $/=""; $_ = <DATA>; while (s/(\d+ is good.*?)<HR>//s) { push @foo, $1; } print $_, "\n--------------\n" foreach (@foo); __DATA__ <HR> 1 is good<BR> useless data<BR> useless data<BR> useless data<BR> useless data<BR> <HR> 2 is not good <BR> useless data<BR> useless data<BR> useless data<BR> useless data<BR> <HR> 3 is good<BR> useless data<BR> useless data<BR> useless data<BR> useless data<BR> <HR> 4 is not good <BR> useless data<BR> useless data<BR> useless data<BR> useless data<BR> <HR>