Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 04-27-2018, 01:57 AM   #1
jvorzimmer
Member
jvorzimmer began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Jun 2013
Device: Samsung Galaxy Tab2 7
Regex Search in Calibre Question

I'm trying to create a regex search in Calibre that finds unmatched smart quotes.

With this search I can find open quotes in a paragraph without a matching close quote:

“[^”]+\</p\>

I also have tried to create corollary search that finds close quotes without an open quote. But this search will only match a line if the quote is missing at the beginning of a paragraph, even if it's further on in the paragraph:

\<p.*\"\>[^“].*”.*\<\/p\>

What am I doing wrong here? Any help would be appreciated.

Thanks,
Jeff
jvorzimmer is offline   Reply With Quote
Old 04-27-2018, 02:36 AM   #2
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 15,116
Karma: 24708566
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo: Touch, Glo, Aura H2O, Glo HD, Aura ONE, Clara HD
I can't test it at the moment, but I think the following is what you need:

Code:
\<p.*?\>[^“]*”.*\<\/p\>
The change for matching the open tag isn't really needed, but your would only match if the tag included an attribute.
davidfor is online now   Reply With Quote
Old 04-27-2018, 02:52 AM   #3
jbacelar
Interested in the matter
jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.
 
jbacelar's Avatar
 
Posts: 253
Karma: 426060
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook Touch HD
Can this help you?

<p[^“]*”.*</p>
jbacelar is offline   Reply With Quote
Old 04-27-2018, 10:19 AM   #4
jvorzimmer
Member
jvorzimmer began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Jun 2013
Device: Samsung Galaxy Tab2 7
Quote:
Originally Posted by jbacelar View Post
Can this help you?

<p[^“]*”.*</p>
This works, but it is a little too greedy. It selects all the lines back to the first instance of a paragraph tag not followed by an open quote.

How can I limit it just to the line?

Thanks. I'm getting close.

Jeff
jvorzimmer is offline   Reply With Quote
Old 04-27-2018, 10:21 AM   #5
jvorzimmer
Member
jvorzimmer began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Jun 2013
Device: Samsung Galaxy Tab2 7
See below.

Last edited by jvorzimmer; 04-27-2018 at 10:29 AM.
jvorzimmer is offline   Reply With Quote
Old 04-27-2018, 10:24 AM   #6
jvorzimmer
Member
jvorzimmer began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Jun 2013
Device: Samsung Galaxy Tab2 7
Quote:
Originally Posted by davidfor View Post
Code:
\<p.*?\>[^“]*”.*\<\/p\>
The change for matching the open tag isn't really needed, but your would only match if the tag included an attribute.
Granted, but that doesn't seem to be the problem here.
jvorzimmer is offline   Reply With Quote
Old 04-27-2018, 05:19 PM   #7
jbacelar
Interested in the matter
jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.
 
jbacelar's Avatar
 
Posts: 253
Karma: 426060
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook Touch HD
Let's see if this can help you.

<p[^“/]*”.*</p>
jbacelar is offline   Reply With Quote
Old 04-27-2018, 10:07 PM   #8
jvorzimmer
Member
jvorzimmer began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Jun 2013
Device: Samsung Galaxy Tab2 7
That works!

Quote:
Originally Posted by jbacelar View Post
<p[^“/]*”.*</p>
That works! Excuse my ignorance but was does the addition of the forward slash do?
jvorzimmer is offline   Reply With Quote
Old 04-28-2018, 01:50 AM   #9
jbacelar
Interested in the matter
jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.
 
jbacelar's Avatar
 
Posts: 253
Karma: 426060
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook Touch HD
It is to avoid matching with </p>
jbacelar is offline   Reply With Quote
Old 04-28-2018, 09:48 AM   #10
jvorzimmer
Member
jvorzimmer began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Jun 2013
Device: Samsung Galaxy Tab2 7
Thank you. I really appreciate it.
jvorzimmer is offline   Reply With Quote
Old 04-28-2018, 10:58 AM   #11
jbacelar
Interested in the matter
jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.
 
jbacelar's Avatar
 
Posts: 253
Karma: 426060
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook Touch HD
You are welcome.
jbacelar is offline   Reply With Quote
Reply

Tags
calibre, quotes, regex, unbalanced, unmaatched

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex in search problems (NOT Search&Replace; the search bar) lairdb Calibre 3 03-15-2017 07:10 PM
Regex Search doesn't search all files in Edit Book GregTheGrate Editor 8 11-08-2016 12:47 AM
Request: multi-search and multi-replace regex question iienderii Library Management 1 04-17-2016 03:15 PM
What is format to search for unicode in calibre with regex? mrmikel Editor 4 01-15-2014 06:33 AM
calibre search & replace question Kelby ePub 1 09-29-2011 01:14 PM


All times are GMT -4. The time now is 11:03 PM.


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