View Single Post
Old 02-01-2013, 08:26 AM   #1
Contre-jour
Junior Member
Contre-jour began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Nov 2012
Device: Kindle
Regex Help: Find page number & Replace+Remove 2x Line Breaks in Sigil



Hi everyone!

I went through the forum posts on using Regex in Sigil to find and replace characters in an ebook and I tried the methods suggested resulting in abject failure. Please help.

I have an e-book with 400+ page numbers appearing like this:

Code:
<p>I want to keep this text</p>

<p>100</p>

<p>I want to keep this text</p>
Note that there are empty lines above and below the page number line (100, in this example).
I need to remove the page number line and the empty lines above and below it.

I did this in Sigil (Mode: Regex):

Find: <p>([0-9]+)</p>
Replace: /1 ------> (space - slash - one)

It found the page number but only removed the <p></p> tags plus the first 2 digits, leaving the last digit in between intact. (In this example, "0"). It also did not remove the empty lines before and after it.

Please could someone help to correct my code so that I will end up with this:

Code:
<p>I want to keep this text</p>
<p>I want to keep this text</p>
<p>I want to keep this text</p>
Thanks in advance!!

Contre-jour
Contre-jour is offline   Reply With Quote