![]() |
#1 |
Junior Member
![]() 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> The other saved searches work ok. Removed and reinstalled Calibre. |
![]() |
![]() |
![]() |
#2 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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?
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() 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> |
![]() |
![]() |
![]() |
#4 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. ![]() |
![]() |
![]() |
![]() |
#5 |
Junior Member
![]() 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 |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Junior Member
![]() 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"><p([^>]*>\s*(<[^/].+?>)*Chapter.+?</)p></pre> |
![]() |
![]() |
![]() |
#7 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,228
Karma: 23446430
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.
|
![]() |
![]() |
![]() |
#8 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: May 2015
Device: Sony Reader PRS-T2
|
|
![]() |
![]() |
![]() |
#9 |
Junior Member
![]() 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> Code:
<p class="PCurrentAndTimesNewRomanAnd10ptAndCentreAlignmentAndLeftIndentAndRightIndentAndSpacingAfter"><span><span class="calibre18">Chapter 8</span></span></p> ![]() |
![]() |
![]() |
![]() |
#10 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,228
Karma: 23446430
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 |
![]() |
![]() |
![]() |
#11 |
Junior Member
![]() 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. |
![]() |
![]() |
![]() |
#12 |
Junior Member
![]() 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. |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
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 |