View Single Post
06-22-2012, 09:00 PM
#1
Dan is offline Dan
Dan's Avatar
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
 
Posts: 3,164
iTrader: 15 / 86%
 

Dan is an unknown quantity at this point

  Old  Wrapping new lines as paragraphs.

http://codepad.org/C18gmK1y

I want every knew line to be a paragraph. If a knew line is blank it should be ignored.

Code:
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
Aenean eu dui ligula, et sodales arcu.
<p>Suspendisse id augue nec diam porta tristique.</p>
Should be

Code:
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p>Aenean eu dui ligula, et sodales arcu.</p>
<p>Suspendisse id augue nec diam porta tristique.</p>
My regex is a bit naff. Has someone had to do this before? Been bugging me for a while.

EDIT: Never mind. Rewrote the regex and have it working correctly.

Reply With Quote