View Single Post
Old 06-30-2015, 12:55 AM   #12
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by avantman42 View Post
I don't claim to be great at regular expressions, but I think this should work, and preserve any class/style attributes in the paragraph:

Find:
Code:
(<p[^>]+>)<\/p>(.*)
Replace:
Code:
\1\2</p>
I would explicitly leave out paragraph tags in the text body, as such:

Code:
(<p(?: [^>]+)?>)</p>((?:(?!</?p>).)+)
Using the power of negative lookarounds.
eschwartz is offline   Reply With Quote