View Single Post
Old 09-26-2015, 11:09 PM   #12
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,796
Karma: 146391129
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by ignaz wrangel View Post
the regex I posted produces that, it selects the marker and the following opening <p>, and replaces the lot with <p class="scenebreak">, the rest just remains in place ("some paragraph text</p>")
You do have a bug in your regex.

<p><br /></p>[^<]*<p\b[^>]*> <---incorrect

<p><br /></p>[^<]*<p> <---correct

You do not want to replace the following <p> willy nilly if hit has a class. You want to only replace the br line and the p only if the <p> is just a plain <p>. If it has a class and you want to replace the p and the class, run the regex again specifying the specific class. Then you can see if you have any more br lines left and how you want to deal with them.
JSWolf is offline   Reply With Quote