View Single Post
Old 05-30-2015, 12:44 PM   #1
hidden.platypus
Connoisseur
hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.
 
hidden.platypus's Avatar
 
Posts: 89
Karma: 190508
Join Date: May 2014
Device: Android
Q: Regex Find and Replace delete surrounding tags

Hi all,

I have no clue what I'm doing, and now I'm stuck.

I apparently understand the find part of the Find and Replace function. It finds what it I want it to find, but the Replace section won't cooperate. So there's something I don't understand. Any help would be appreciated.

I converted a docx to epub using Calibre.

I am now using the Edit Book app in Calibre to do final polishing.

Calibre created a ton of <span class="calibre5"> tags. I'm learning to use css to format ebooks (and learning css). What I'm attempting to do is delete the opening span tag and the closing span tag and leave what's inside the tag alone. I am using css to do what the <span class="calibre5"> tag is already doing.

So I want to remove the span tags surrounding a string and leave the string untouched.

In the code I have this:

Code:
<span class="calibre5">The law is inevitable.</span>
I want to do a search and replace that leaves only this

Code:
The law is inevitable.
My Search string is:
Code:
<span class="calibre5">[^<>]+</span>
But anything I put in the Replace box gets literally replaced.

So if I put:
Code:
(?<=<span class="calibre5">)(.*?)(?=<\/span>)
Then instead of getting
Code:
The law is inevitable.
when I push Replace

I get:
Code:
(?<=<span class="calibre5">)(.*?)(?=<\/span>)

And if i put

Code:
/1
I get
Code:
/1
So you get the picture.

How can I learn what I'm doing wrong?
hidden.platypus is offline   Reply With Quote