View Single Post
Old 05-10-2014, 03:51 AM   #9
toothpicz
Junior Member
toothpicz will become famous soon enoughtoothpicz will become famous soon enoughtoothpicz will become famous soon enoughtoothpicz will become famous soon enoughtoothpicz will become famous soon enoughtoothpicz will become famous soon enough
 
toothpicz's Avatar
 
Posts: 6
Karma: 610
Join Date: Aug 2011
Device: Calibre, FBreader(android)
Hi all,

I have a similar problem. My chapter headings are "1.", "2." etc. without any heading tags too. And I wanted to create a ToC by giving the headings tag and then using those tags to form the Contents.

My problem:
I've managed to use regex to capture the headings, but do not know how to replace it, because I still need to keep the "5." intact, and use replace all to change all the 100+ headings.

original code:
Code:
<p class="calibre2"><span class="bold">5.</span></p>
My regex to find:
Code:
<p class="calibre2"><span class="bold">\s*[0-9]+.*?</span></p>
My regex to replace:
Code:
<p class="calibre2"><span class="bold"><h3>???</h3></span></p>
Where ??? is a mystery to me. Please help!
toothpicz is offline   Reply With Quote