Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,256
Total Threads: 81,169
Total Posts: 566,839
There are 52 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

Wrapping new lines as paragraphs.

Thread title: Wrapping new lines as paragraphs.
Reply    
    Thread tools Search this thread Display Modes  
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
Reply    


Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed