I have the following stored inside $text
:
<h1>Bonjour tout le monde (diverses langues) !</h1>
<h2>Anglais</h2>
Hello World!
<quote>Every first computer program starts out "Hello World!".</quote>
<h2>Espagnol</h2>
¡Hola mundo!
<image=http://example.com/IMG/jpg/person.jpg>
And I want to insert some
<p>...</p>
tags around the paragraphs that are not already in a tag.
I tried this
$text =~ s/(?:<.*>)*(.*)/<p>$1<\/p>/g;
But the substitution does not keep my non-capturing groups. It produces this instead:
<p>
</p><p>
Hello World!
</p><p>
</p><p>
¡Hola mundo!
</p><p>
</p><p></p>
Any ideas ?
Thanks.