Thread: Regex examples
View Single Post
Old 06-05-2012, 02:09 PM   #74
paulfiera
Addict
paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.
 
paulfiera's Avatar
 
Posts: 339
Karma: 3102
Join Date: Dec 2010
Location: EU
Device: iPad, Kobo Glo
Quote:
Originally Posted by meme View Post
You don't say what the original Chapter One looks like in code view. Just the text isn't sufficient to make sure the find/replace is correct.

Assuming you have
Code:
<p>Chapter SOMETHING</p>
and want
Code:
<h1>Chapter SOMETHING</h1>
then
Code:
Find:    (?sU)<p>Chapter (.*)</p>
Replace: <h1>Chapter \1</h1>
might get you what you want.
Many thanks, meme. You are correct.

In Code View it is

Quote:
<p class="calibre4">CHAPTER 1</p>
Using JeremyR's code seems to do the trick. The Chapters are now

Quote:
<h3>CHAPTER 1</h3>
I omitted the horizontal line and used calibre to split the html at every h3.

Don't know if I'm doing this right though

I have more books with the same issue. I'll try with your code next time.

Many thanks.
paulfiera is offline   Reply With Quote