View Single Post
Old 07-27-2014, 02:55 AM   #1
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
s&r for paired tags

I've got a book file full of code like :

Code:
<p class="calibre2"><span class="none2">blah blah blah</span></p>

Is there a way I can remove these spans, (the "none2" ones) to get

Code:
<p class="calibre2">blah blah blah</p>
without messing up any other spans?

I can remove the opening by simple s&r, but then I would have orphaned </span>, but could not just delete </span> without screwing up other spans.


I could change "<span class="none2">" to "<span>" and neuter them, but I really hate to leave junk code in the file.


-- PS, I know what regex are,and have written some simple ones, but parsing HTML is a bit hairy.

Last edited by AlanHK; 07-27-2014 at 03:23 AM.
AlanHK is offline   Reply With Quote