View Single Post
Old 07-24-2010, 04:49 PM   #1
romnempire
Member
romnempire began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Dec 2009
Device: Kindle 2
xpath for chapter detection

i have a TXT to EPUB conversion that I'm trying to work through.

the TXT uses a linebreak and tab to signify a new paragraph, and two linebreaks before and after the chapter name

in order to detect chapters, with no obvious "chapter" in the chapter title, I copied a list of the names of the chapter titles from the toc and used find replace and the xpath expression wizard to create this xpath expression

//*[re:test(., "^SOMEONE LIKE YOU$|^Taste$|^Lamb to the Slaughter$|^Man from the South$|^The Soldier$|^My Lady Love, My Dove$|^Dip in the Pool$|^Galloping Foxley$|^Skin$|^Poison$|^The Wish$|^Neck$|^The Sound Machine$|^Nunc Dimittis$|^The Great Automatic Grammatizator$|^Claud's Dog$|^The Ratcatcher$|^Rummins$|^Mr Hoddy$|^Mr Feasey$|^EIGHT FURTHER TALES OF THE UNEXPECTED$|^The Umbrella Man$|^Mr Botibol$|^Vengeance is Mine Inc.$|^The Butler$|^Ah, Sweet Mystery of Life$|^The Bookseller$|^The Hitchhiker$|^The Surgeon$", "i")]

to make this work, I need the expression to recognize the paragraph as true if the entire 'chapter title' paragraph matches one of the literal strings. However, the expression seems to be matching any paragraph that contains the string.

can you help me make this work?
romnempire is offline   Reply With Quote