not negative lookbehind (again)

[email protected] (allan) Mon, 05 Nov 2001 23:08:25 +0100
Newsgroups perl.macperl.anyperl
Message-ID <[email protected]>
hi
im trying to make a replace of the following string:

<p>this is<br>
ok</p>
this is not ok
<p>this is ok</p>


to:
<p>this is<br>
ok</p>
<p>this is not ok</p>
<p>this is ok</p>


i have tried endless negative lookaheads (and now its hurting) i simply
cant find a solution. the best i have a somewhat reverse logic like in
the code below. this replaces everything apart from the "this is not ok
line". this is not very elegant. has someone done this before without
too much scripting?

thanks allan


#!perl -w

use strict;
open FILE, "1.html" or die $!;

local $/;
my $org_str = <FILE>;

$org_str =~ s/<p>(.+?)<\/p>//igsx;
print "<p>".$org_str."</p>";

__END__