Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 04-14-2015, 07:23 PM   #1
LadyKate
Fanatic
LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.
 
Posts: 515
Karma: 1470724
Join Date: Jul 2013
Location: Quebec CA
Device: android 4 (samsung tablet and asus tablet)
Some regex help to clean up authors

I am looking for a way to search for double initials in the author field.

I use [A-Z]\.[A-Z]\. to search for names like F.I. Jones but [A-Z][A-Z] matches almost everything.

I can't seem to figure out how to look for FI Jones or AA Jones or AI Jones etc.

My understanding from the manual was that [A-Z] searched only for capitals but in practice it seems to match either upper or lower case. I tested this by searching for [a-z][A-Z][a-z] on a library in the author field and almost all authors were displayed.

Any ideas would be of help. I prefer to have all my author's initials displayes as I. I. Name or First I. Name etc. It makes author management easier.
LadyKate is offline   Reply With Quote
Old 04-14-2015, 08:04 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: 30,939
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by LadyKate View Post
I am looking for a way to search for double initials in the author field.

I use [A-Z]\.[A-Z]\. to search for names like F.I. Jones but [A-Z][A-Z] matches almost everything.

I can't seem to figure out how to look for FI Jones or AA Jones or AI Jones etc.

My understanding from the manual was that [A-Z] searched only for capitals but in practice it seems to match either upper or lower case. I tested this by searching for [a-z][A-Z][a-z] on a library in the author field and almost all authors were displayed.

Any ideas would be of help. I prefer to have all my author's initials displayes as I. I. Name or First I. Name etc. It makes author management easier.
Quality Check PI: Check Metadata: Author Initials
quality check PI: Fix Author Initials:<selected format> is there to FIX
theducks is offline   Reply With Quote
Advert
Old 04-15-2015, 07:01 AM   #3
LadyKate
Fanatic
LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.
 
Posts: 515
Karma: 1470724
Join Date: Jul 2013
Location: Quebec CA
Device: android 4 (samsung tablet and asus tablet)
Thank you for the quick find for most initials problems.

I am still trying to figure out how regex in calibre search works as I use regular expressions a lot when editing html and it is logical to clean up titles and authors using it.

For Instance, I really want to search for the case of "Aa " in authors as it occurs frequently enough that the second initial is mistakenly in lower case. I just am having a bit of a time getting the regex to match "Aa " versus darn near everything.

For instance. How do I use regex to search for AA Name? If I use [A-Z][A-Z] [A-Z]. which I expect to match to AA Name it matches "Orbit Various Authors" and "Various Author" as well as the expected "AA Name".

As two uppercase characters followed by a space, an uppercase character and then anything is how I translate the search string the results confuses me.

I guess I'm looking for a lot more info about how regex works inside calibre as compared to in say edit pad pro.
LadyKate is offline   Reply With Quote
Old 04-15-2015, 11:46 AM   #4
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: 30,939
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by LadyKate View Post
Thank you for the quick find for most initials problems.

I am still trying to figure out how regex in calibre search works as I use regular expressions a lot when editing html and it is logical to clean up titles and authors using it.

For Instance, I really want to search for the case of "Aa " in authors as it occurs frequently enough that the second initial is mistakenly in lower case. I just am having a bit of a time getting the regex to match "Aa " versus darn near everything.

For instance. How do I use regex to search for AA Name? If I use [A-Z][A-Z] [A-Z]. which I expect to match to AA Name it matches "Orbit Various Authors" and "Various Author" as well as the expected "AA Name".

As two uppercase characters followed by a space, an uppercase character and then anything is how I translate the search string the results confuses me.

I guess I'm looking for a lot more info about how regex works inside calibre as compared to in say edit pad pro.
did you remember to precede your search term with the REGEX flag "~
(there are examples on the Help:GUI Search & Sort section
theducks is offline   Reply With Quote
Old 04-15-2015, 12:29 PM   #5
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,362
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by LadyKate View Post
For instance. How do I use regex to search for AA Name? If I use [A-Z][A-Z] [A-Z]. which I expect to match to AA Name it matches "Orbit Various Authors" and "Various Author" as well as the expected "AA Name".
Use
Code:
^[A-Z][A-Z] [A-Z]
As you wrote it, the expression would find any name that has any two characters at the end of a word, then a space, then a character. Adding the leading anchor (^) tells it that it must match two characters at the beginning of the name, then a space, then a character.

Note that the meaning of ^ is different when used inside [ ] characters. In that context it means "invert the set". For example, [^AB] means everything except A and B.
chaley is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Little F&R RegEx help to clean a Calibre conversion phossler Sigil 4 09-03-2012 08:17 PM
Short Fiction Martinez, Brian: A Good Clean, A Harsh Clean. v1. PDF, 13th Dec 2010 BrianMartinez Other Books 0 12-13-2010 09:27 PM
Short Fiction Martinez, Brian: A Good Clean, A Harsh Clean. v1. 13th Dec 2010 BrianMartinez Kindle Books 0 12-13-2010 09:25 PM
Short Fiction Martinez, Brian: A Good Clean, A Harsh Clean. v1. 13th Dec 2010 BrianMartinez ePub Books 0 12-13-2010 09:23 PM
Short Fiction Authors, Various: Stories by Foreign Authors: Polish, Greek, Belgian. v1, 20 Feb 2008 nrapallo IMP Books (offline) 0 02-22-2008 12:45 AM


All times are GMT -4. The time now is 01:30 PM.


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