View Single Post
Old 01-12-2010, 07:03 AM   #1
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Problem with regular expressions

I'm having some trouble writing a regular expression to delete page headers in the conversion options. The page header I'm trying to delete basically looks like
Code:
<p class="calibre1">
Title</p><p class="calibre1">
Page 42 of 230</p>
so I figured the regexp needed should look like
Code:
Title</p><p class="calibre1">\nPage [0-9]* of [0-9]*
to match the part from "Title" to the total page number, which is what I want to remove. Now, this works fine if I just use the part up to "\n" or the part after it, which matches the first or the second line I want removed, respectively. But as soon as I try to cobble the two lines together, I don't get any match. I've tried every variation of \n,\s and so forth that I could think of, including slapping some * and ? behind it and fooling around with groups, nothing seems to work.
Seeing as I've never used regular expressions before and just skimmed over the Calibre user manual to piece it together, I'm sure there's something I'm missing, but I cant figure out what it is. What I can figure out is that I somehow don't get how to match a newline. Could anyone help?

Last edited by Manichean; 01-12-2010 at 07:07 AM.
Manichean is offline   Reply With Quote