Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 05-20-2015, 12:45 PM   #1
zetbox
Junior Member
zetbox began at the beginning.
 
Posts: 8
Karma: 10
Join Date: May 2015
Device: Sony Reader PRS-T2
Editor freezes while searching

I’ve got this Regex for searching chapters
Code:
 <p([^>]*>\(<[^/].+?>)*chapter.+?</)p>
It worked fine for days. Today the editor stopped liking it. It will run once and then freezes.
The other saved searches work ok. Removed and reinstalled Calibre.
zetbox is offline   Reply With Quote
Old 05-20-2015, 04:11 PM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Why are you escaping one half of a parentheses pair?
eschwartz is offline   Reply With Quote
Advert
Old 05-20-2015, 08:10 PM   #3
zetbox
Junior Member
zetbox began at the beginning.
 
Posts: 8
Karma: 10
Join Date: May 2015
Device: Sony Reader PRS-T2
I forgot to remove the backslash. I run it actually like this
Code:
<p([^>]*>\s*(<[^/].+?>)*Chapter.+?</)p>
zetbox is offline   Reply With Quote
Old 05-20-2015, 09:13 PM   #4
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Well, that looks a lot better.

I'm afraid I don't know why the editor would hang on a well-formed regex though.
eschwartz is offline   Reply With Quote
Old 05-20-2015, 09:32 PM   #5
zetbox
Junior Member
zetbox began at the beginning.
 
Posts: 8
Karma: 10
Join Date: May 2015
Device: Sony Reader PRS-T2
Update:
I removed Calibre. Deleted any files related to it. Reinstalled.
I can run the RE from find/replace but not from saved searches it would run once ok but then stops, no freezing now - even after removing all searches and starting from scratch.
Any idea?
thanks a lot
zetbox is offline   Reply With Quote
Advert
Old 05-20-2015, 10:36 PM   #6
zetbox
Junior Member
zetbox began at the beginning.
 
Posts: 8
Karma: 10
Join Date: May 2015
Device: Sony Reader PRS-T2
Update 2:
Find/Replace stopped working: Error No matches were found and this is what if copied to clipboard:
Code:
calibre, version 2.28.0
ERROR: Not found: <p>No matches were found for <pre style="font-style:italic">&lt;p([^&gt;]*&gt;\s*(&lt;[^/].+?&gt;)*Chapter.+?&lt;/)p&gt;</pre>
zetbox is offline   Reply With Quote
Old 05-20-2015, 10:50 PM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,115
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No matches being found is not "stopped working". It means your regex did not match anything.
kovidgoyal is offline   Reply With Quote
Old 05-21-2015, 09:12 AM   #8
zetbox
Junior Member
zetbox began at the beginning.
 
Posts: 8
Karma: 10
Join Date: May 2015
Device: Sony Reader PRS-T2
Quote:
Originally Posted by kovidgoyal View Post
No matches being found is not "stopped working". It means your regex did not match anything.
My bad I didn't set it to search All Text Files.
It looks like the freezing was caused by corrupt saved search
zetbox is offline   Reply With Quote
Old 05-24-2015, 03:52 PM   #9
zetbox
Junior Member
zetbox began at the beginning.
 
Posts: 8
Karma: 10
Join Date: May 2015
Device: Sony Reader PRS-T2
Update 3:
It looks like Calibre Editor doesn't like my RE - Sigil runs it with no problem.
The RE engine goes to an endless loop (rather than freezes) if there are more than 2 tags like:
Code:
<p id="filepos2207" class="calibre1"><span class="calibre2"><span class="bold">Chapter One</span></span></p>
but it doesn't have a problem with this:
Code:
<p class="PCurrentAndTimesNewRomanAnd10ptAndCentreAlignmentAndLeftIndentAndRightIndentAndSpacingAfter"><span><span class="calibre18">Chapter 8</span></span></p>
zetbox is offline   Reply With Quote
Old 05-24-2015, 11:33 PM   #10
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,115
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I cannot reproduce that. Steps I tried:

1) Paste: <p id="filepos2207" class="calibre1"><span class="calibre2"><span class="bold">Chapter One</span></span></p> into an html file
2) Paste: <p([^>]*>\s*(<[^/].+?>)*Chapter.+?</)p>
into the find box and set mode to regex and search in current file
3) Click Find, the tag from (1) is highlighted
kovidgoyal is offline   Reply With Quote
Old 05-25-2015, 11:29 AM   #11
zetbox
Junior Member
zetbox began at the beginning.
 
Posts: 8
Karma: 10
Join Date: May 2015
Device: Sony Reader PRS-T2
As I can remember it is always after the second hit of Find or Find then Count All or Replace all

BUT...

Update 4:
Today it looped on <p class="calibre2" id="filepos3012"><span class="calibre3">Chapter 1</span></p>
I tried it a few times with the same result.
I replaced the "bad" entries with "good": <p class="p3"><span class="t2"><b>Chapter Two</b></span></p> and now it loops after first Find hit. I tested the "improved" file on Sigil - no problem.
So it is something else.

Last edited by zetbox; 05-25-2015 at 11:45 AM.
zetbox is offline   Reply With Quote
Old 05-25-2015, 04:44 PM   #12
zetbox
Junior Member
zetbox began at the beginning.
 
Posts: 8
Karma: 10
Join Date: May 2015
Device: Sony Reader PRS-T2
Update 5:
I exported chapter html files from the "improved" epub that Editor had a problem with and made a new epub with Sigil. The Editor RE engine had no problem with the new file.
My guess is Sigil cleaned the html files while importing.

The conclusion: The problem wasn't the line with chapter number but some character/garbage after that.
I may try to run Editor in debug mode to find the problem.
zetbox is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Editor: ToC Editor: Start entry macnab69 Editor 2 06-25-2014 11:15 AM
Troubleshooting K3 freezes randomly vangop Amazon Kindle 2 04-23-2014 02:16 AM
Book Editor TOC Editor Isue? weberr Editor 2 04-17-2014 11:13 AM
Touch Freezes on new content NightStar76 Kobo Reader 2 12-31-2011 01:42 AM
What do I do when my K3 freezes? granturissimus Amazon Kindle 11 10-20-2011 05:04 PM


All times are GMT -4. The time now is 04:35 PM.


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