Thread: Regex examples
View Single Post
Old 10-08-2014, 05:53 PM   #427
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)
Find:
Code:
<p( [^<>]+)?>["“]((?!</p>).)*[^"”]</p>
Assumes the paragraph starts with a quote mark, accounts for smart or dumb quotes, matches optional attributes in the para tag, and matches tags in the paragraph assuming they aren't the para tag (see HERE for how).

This one finds text before the quotes too:
Code:
<p( [^<>]+)?>((?!</p>).)*["“]((?!</p>).)*[^"”]</p>

Last edited by eschwartz; 10-08-2014 at 05:58 PM.
eschwartz is offline   Reply With Quote