r/regex•
Vanzig

Regex expression for deleting HREF footnotes in ebooks

Some epub books are filled with unnecessary hyperlinks that are resulting in horrible popups when I'm trying to click to go to the next page. The format of the links are like

<a href="endnotes.xhtml#en0045en" id="en0045"> <a href="endnotes.xhtml#en0046en" id="en0046"> <a href="endnotes.xhtml#en0047en" id="en0047">

Calibre ebook library replaced their delete footnotes option with a REGEX find-and-replace bar. I've googled 30 other times people pointed out the annoyance in their books and all they got from the kindle/ebook people was a middle finger telling them just dont click on the page ever. Or learn complicated REGEX to what kindle should have a goddamn checkbox to disable...

Will someone please post the REGEX so I can find-and-replace these annoying HTML hyperlinks? Google is useless for it if I'm not a REGEX expert already.

Posted Mar 20, 2019, 2:07 AM UTC

22
ndpjs•

I've never used Calibre, but this could work from the examples you gave:

<a href="endnotes.+?>

https://regex101.com/r/q553Wt/1

2
VanzigOP•

Thank you so much, kind stranger. It worked perfectly. Few seconds formating to avoid hours of misclicks.

2