Thread: Regex examples
View Single Post
Old 08-31-2014, 12:55 PM   #412
eschwartz
Irrational Optimist
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.
 
Posts: 6,501
Karma: 10683802
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch (Wifi only)
Quote:
Originally Posted by DiapDealer View Post
My bad. I didn't notice the space was inside the optional grouping. Part of the reason I don't like to use a lot of extraneous grouping in my regex.


If you're worried about matching the wrong tags (like <image for <i), just make sure there's a word break after the element name.
Code:
<p\b[^>]*>
Or if you're in calibre's editor, even the end-of-word match:
Code:
<p\M[^>]*>
That works too.

Po-tay-to po-tah-to.

Doesn't confuse me, I got used to doing it this way (seems in my subjective opinion to make more sense), etc. Never really fell in love with word boundaries.
eschwartz is offline   Reply With Quote