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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 03-15-2017, 02:13 PM   #1
lairdb
dog ear
lairdb began at the beginning.
 
Posts: 30
Karma: 12
Join Date: Jan 2012
Device: lots
Regex in search problems (NOT Search&Replace; the search bar)

I'm having real trouble getting regex search in the search bar to work, especially within the identifiers field. (I don't know if it's a Python thing, but multi-valued fields seem to be getting treated... oddly.)

Here's what I'm trying to accomplish, in case there's an easier way. What I want the search to yield are rows that have an odid identifier that is not an ak/prime or ak/unlimited identifier. Here are three (made up) identifiers records:

Code:
isbn:9781611099690, odid:B00AESRRQS@ak/prime&B00AESRRQS@ak/unlimited

isbn:9781439147993, amazon:143914799X, goodreads:6933152, google:ibWojDN848kC, odid:346656@sdcl.overdrive.com&346656@sfpl.overdrive.com

isbn:9781439147993,  odid:346656@sdcl.overdrive.com&346656@sfpl.overdrive.com&B00AESRRQS@ak/unlimited
In this example, I would get rows 2 and 3, because they have odid identifiers that are not ak/prime or ak/unlimited; I would not get record 1 because although it has odid identifiers, none of them are non-ak.

The regex odid:.*@(?!(ak\/u|ak\/p)) does what I expect in a tester, but I can't get it to work in Calibre.

ETA: I've tried
odid:.*@(?!(ak\/u|ak\/p))
~odid:.*@(?!(ak\/u|ak\/p))
"~odid:.*@(?!(ak\/u|ak\/p))"
identifiers:"~odid:.*@(?!(ak\/u|ak\/p))"
and none of them yield results.

Thanks.

Last edited by lairdb; 03-15-2017 at 02:25 PM.
lairdb is offline   Reply With Quote
Advert
Old 03-15-2017, 02:45 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 20,877
Karma: 20350468
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: K4NT, Galaxy Tab 2(RIP)
the field name is identifiers:
You are working with a (sub) field value
theducks is online now   Reply With Quote
Old 03-15-2017, 04:05 PM   #3
jhowell
Wizard
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 1,658
Karma: 17056947
Join Date: Nov 2011
Location: Florida
Device: iPad Air 2, Kindle PW2, Nexus 7, Fire 5th Gen
This should work:

Code:
identifiers:"=odid:~@(?!ak/(unlimited|prime))"
jhowell is offline   Reply With Quote
Old 03-15-2017, 07:10 PM   #4
lairdb
dog ear
lairdb began at the beginning.
 
Posts: 30
Karma: 12
Join Date: Jan 2012
Device: lots
Quote:
Originally Posted by theducks View Post
the field name is identifiers:
You are working with a (sub) field value
Of course, a subfield. What is a subfield?

("Your search - subfield site:calibre-ebook.com - did not match any documents.")

Quote:
Originally Posted by jhowell View Post
This should work:
Code:
identifiers:"=odid:~@(?!ak/(unlimited|prime))"
Yes, thanks, and simpler than mine. Is there an actual syntax somewhere for the search box, where syntax like that might be discussed or exampled?

https://manual.calibre-ebook.com/gui...arch-interface does not have anything about subfields, and the passing mention of the equals sign is incomplete and possibly inconsistent.

https://manual.calibre-ebook.com/regexp.html has a huge explanation of how regexes work -- and nothing at all about how to use them in the search bar, which is substantially different from the S&R usage.

Thanks.
lairdb is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex Search doesn't search all files in Edit Book GregTheGrate Editor 8 11-08-2016 12:47 AM
regex search/replace - how to? Alt68er Sigil 1 03-11-2014 08:53 PM
Regex help: Edit Meta Search & Replace: Pad with zero _noel_ Calibre 4 11-26-2012 04:31 PM
Search & Replace problems with pdf conversion Longmatys Conversion 1 01-25-2012 04:59 AM
Search & Replace/Regex help!! millertime13 Conversion 4 07-22-2011 02:40 AM


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


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