fork(3) download
  1. #!/usr/bin/perl
  2. $regex = '(<\/?p[^>]*>)|<[^>]*>';
  3. $subject = 'Bad html <a> </I> <p>My paragraph</p> <i>Italics</i> <p class="blue">second</p>';
  4. ($replaced = $subject) =~ s/$regex/$1/eg;
  5. print $replaced . "\n";
Success #stdin #stdout 0s 3564KB
stdin
Standard input is empty
stdout
Bad html   <p>My paragraph</p> Italics <p class="blue">second</p>