Regexp to enclose text with P-tag

SubZane andreas at easywebsite.se
Tue May 18 08:58:16 EDT 2004


I'm looking for help writing a regexp to enclose text with a <p> tag.
The rule is that other HTML tags in the text like <img> and other
block elements should NOT be enclosed by <p>.
example:

lorem ipsum <img src="image.gif" />dolor

should become:

<p>lorem ipsum</p><img src="image.gif" /><p>dolor</p>

Can anyone help me with this? :)



More information about the Python-list mailing list