Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 11-28-2011, 02:05 AM   #1
hirak99
Junior Member
hirak99 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Nov 2011
Device: Galaxy S2
Exclamation Regex works in preview, but not while conversion!

Objective

I have a .txt book from project Gutenberg, where an example chapter header would be -


Code:
[2]

THIEVES BREAK IN AND STEAL
I want to get it in the form -

Code:
<h2>2. THIEVES BREAK IN AND STEAL</h2>
Issue 1
When I try the regex search, it shows as
Code:
<p>[2]</p>
<h2>THIEVES BREAK IN AND STEAL</h2>
Is this expected? I'm hundred percent sure I'm selecting the .txt file. It would be fine if the regex worked properly on this, but it's not working as stated below -

Issue 2
When I use the following regex -
Code:
(?m)<p>\[([\d]*?)\]</p>\s+<h2>.*?</h2>
it matches the titles, but it does not do anything when I actually try to convert!

How can I get the conversion?

Addendum
The book on which I'm trying to operate is the text version here -
http://www.gutenberg.org/ebooks/6984
hirak99 is offline   Reply With Quote
Old 11-28-2011, 03:22 AM   #2
hirak99
Junior Member
hirak99 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Nov 2011
Device: Galaxy S2
Lightbulb

After much trial & error, I found the following to work -
Search
Code:
<p>\[(\d+)\]</p>\s+<p>(.+?)</p>
And replace
Code:
<h2>\1. \2</h2>
Weird. It's not in this format either in the text file or in the search box. I converted text imput to plain, but now set it back to auto and it still works.
hirak99 is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Conversion and Regex Help thedevilsjester Calibre 0 07-16-2010 06:10 PM
Need help with a conversion regex - can't match newline ereader123 Calibre 2 03-29-2010 10:58 AM
Add book regex no longer works magphil Calibre 3 03-24-2010 03:40 PM
new to calibre/ conversion works mon-Sat, not Sunday? gpsloco Calibre 2 12-13-2009 02:35 PM
Multiple html (zip) conversion no longer works Katelyn Calibre 4 08-07-2009 11:52 AM


All times are GMT -4. The time now is 07:44 PM.


MobileRead.com is a privately owned, operated and funded community.