For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > May 2004 > Regexp to enclose text with P-tag









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Regexp to enclose text with P-tag
Andreas N

2004-05-18, 10:32 am


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


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com