Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 08-25-2011, 03:47 PM   #1
camilou
Junior Member
camilou began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2011
Device: Nook
Detected matching strings but they're not gone after converting

Hello, I'm, trying to replace some strings in Calibre and it detects there are 50 matches, I am replacing

Quote:
"To Kill a Mockingbird" By Nelle Harper Lee\d{1,3}</p>\n<p class="calibre3">\s</p>\n<p class="calibre2">(?P<word>.{1})
with

Quote:
\g<word>
The conversion process starts, finishes, but when I double click the file, the strings are still there.

I've tried another regular expression that does the same but I'm still getting the same result.

Quote:
"To Kill a Mockingbird" By Nelle Harper Lee\d{1,3}[\.\s\n<>"\/a-z=0-9]*<p class="calibre2">(?P<word>.{1})
I'm using the latest version of Calibre. I disabled saving the original file (original_epub) but I'm still getting the same problem.

Any idea why is this happening?
camilou is offline   Reply With Quote
Old 08-25-2011, 04:02 PM   #2
camilou
Junior Member
camilou began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2011
Device: Nook
Update: I just tried removing pieces from the regular expression until I got to this one which is working:

Quote:
"To Kill a Mockingbird" By Nelle Harper Lee\d{1,3}</p>\n<p class="calibre3">
So maybe the problem is with the white space character, but that wouldn't explain why the second expression wasn't working either, unless it's something I'm not doing right with all the "\s"

UPDATE 3.:
I tried replacing "\s" with ".*" and it worked. Looks like somehow the program had problems detecting the "\s"? Isn't that just white space? I think it's weird because it could match the strings against the regular expression but then after that it wouldn't replace them.

Any ideas? I'm going to see if maybe the thing I supposed was a whitespace was not really a whitespace by checking the file with an hex editor, but still, if it wasn't a white space, why would it match against "\s"?

Last edited by camilou; 08-25-2011 at 04:09 PM.
camilou is offline   Reply With Quote
Old 08-25-2011, 04:20 PM   #3
itimpi
Wizard
itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.
 
Posts: 4,552
Karma: 950151
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
\s Will match a single whitespace character. You might want to try \s* instead
itimpi is offline   Reply With Quote
Old 08-25-2011, 05:43 PM   #4
camilou
Junior Member
camilou began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2011
Device: Nook
Quote:
Originally Posted by itimpi View Post
\s Will match a single whitespace character. You might want to try \s* instead
Yes, I understand. However, there was only one white space. Let me paste a little of the text in here:

Quote:
<p class="calibre2">Atticus reached up and took off his glasses, turned his good right eye to the witness, and rained questions on her. Judge Taylor said, "One question at a time, Atticus. Give "To Kill a Mockingbird" By Nelle Harper Lee100</p>
<p class="calibre3"> </p>
<p class="calibre2">the witness a chance to answer."</p>
<p class="calibre3"> </p>
And the regular expression I used matches this:

Quote:
<p class="calibre2">Atticus reached up and took off his glasses, turned his good right eye to the witness, and rained questions on her. Judge Taylor said, "One question at a time, Atticus. Give "To Kill a Mockingbird" By Nelle Harper Lee100</p>
<p class="calibre3"> </p>
<p class="calibre2">t
he witness a chance to answer."</p>
<p class="calibre3"> </p>
As you can see the match is perfect, but the thing is, once I close the window and press "Ok" the program won't replace the match, unless I replace that single "\s" with another class, like "." for any character. That's the thing I don't understand. I'm going to read the sticky again and see if there's something about regular expressions and white spaces I might have overlooked.
camilou is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting from Zip to MOBI - Sections not detected NorthboundTrain Conversion 8 06-10-2011 10:29 AM
Matching filenames on device to Calibre DB T.BugReporter Calibre 2 04-11-2011 11:33 AM
Better matching/scanning lbutlr Calibre 3 08-04-2010 03:44 PM
Matching Light for Kobo dixieknits Kobo Reader 2 07-19-2010 02:50 AM
Literary Pattern Matching kennyc News 5 12-16-2009 03:12 PM


All times are GMT -4. The time now is 09:26 AM.


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