Thread: F/R Question
View Single Post
Old 01-08-2015, 09:04 PM   #3
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
You could just use a simple Regex. What you want to do is when you are in the Calibre Editor, when you do a Find, you want to make sure that you set the Mode to "Regex":

Click image for larger version

Name:	CalibreRegex.png
Views:	226
Size:	91.3 KB
ID:	133555

Then you can use this Search/Replace:

Search: <span class="fraction"><span class="numerator">([0-9]+)</span><span class="virgule">⁄</span><span class="denominator">([0-9]+)</span></span>

Replace: \1/\2

In English:

What this says in English is: "find the spans with fraction + numerator" + "grab the number and stick it in \1" + "find the spans with the virgule and denominator" + "grab the number and stick it in \2".

Replace with "the first captured number" + "slash" + "the second captured number".

Your examples:

<li class="ing"><span class="fraction"><span class="numerator">1</span><span class="virgule">⁄</span><span class="denominator">8</span></span> teaspoon freshly ground black pepper</li>

<li class="ing"><span class="fraction"><span class="numerator">1</span><span class="virgule">⁄</span><span class="denominator">3</span></span> cup dried cranberries</li>

This should give you the exact output you were looking for.

Last edited by Tex2002ans; 01-08-2015 at 09:16 PM.
Tex2002ans is offline   Reply With Quote