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? :)