fork download
  1. #!/usr/bin/perl
  2. $text = "<h1>Bonjour tout le monde (diverses langues) !</h1>
  3.  
  4. <h2>Anglais</h2>
  5.  
  6. Hello World!
  7.  
  8. <h2>Espagnol</h2>
  9.  
  10. <¡Hola mundo!>Nested Text<--";
  11.  
  12. $text =~ s/(^[^<\n]+.+|.+[^\/\n>]+$)/<p>$1<\/p>/gm;
  13.  
  14. print $text;
Success #stdin #stdout 0s 6000KB
stdin
Standard input is empty
stdout
<h1>Bonjour tout le monde (diverses langues) !</h1>

<h2>Anglais</h2>

<p>Hello World!</p>

<h2>Espagnol</h2>

<p><¡Hola mundo!>Nested Text<--</p>