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 06-20-2017, 04:11 PM   #1
MontyJ
Addict
MontyJ began at the beginning.
 
Posts: 224
Karma: 10
Join Date: Jul 2012
Device: Kindle
Metadata Regex Search/Replace

Hola!

I am trying to do what I thought was going to be a simple search and replace in the metadata editor. Here's what I need to do:

Every once in a while I get a batch of books that seem to have a lot of the author initials run together and it becomes tedious to have to manually go through all the entries and manually edit them. So I need to look for connected uppercase letters in the authors field and separate them with a space. Example:

Smith, John XY, or
Smith, XY John, or
John XY Smith, or
Smith, XY

The "XY" needs to come out "X Y", ie a space inserted.

But NOT affect something like Smith, John Xy, or the other arrangements of that.

I have tried:
Code:
\b([A-Z]){2}\b
And that finds the right occurrence, but can't capture it so I can insert a space.

\b([A-Z])([A-Z])\b
But that fails on the "Xy" occurrence when I use the replacement of:

\1 \2
Note the space in between.
I have tried a half dozen other short and lengthy regex's I found, but none work for this situation..

Ideas?

Thanks!
MontyJ is offline   Reply With Quote
Old 06-20-2017, 08:12 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: 31,047
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Look at the Quality check Plugin
It has bot a detect and a FIX section for this issue. Yor preset your desired format.
It does many other things. Check it out. It is FREE
theducks is offline   Reply With Quote
Advert
Old 06-21-2017, 12:00 AM   #3
MontyJ
Addict
MontyJ began at the beginning.
 
Posts: 224
Karma: 10
Join Date: Jul 2012
Device: Kindle
Quote:
Originally Posted by theducks View Post
Look at the Quality check Plugin
It has bot a detect and a FIX section for this issue. Yor preset your desired format.
It does many other things. Check it out. It is FREE
Thanks! I do use that plugin...very helpful. I had not tried it on this problem, tho, so learned something new!

It will indeed find all the XY initial entries so I can then put them into a virtual library to work on, but it won't actually make the change, so it is still a manual process at that point. Am I missing something the Quality Check plugin can do that will fix the Initials problem?

If I can get the Metadata Editor regex to work, it will easily scan the entire library for those XY occurrences and take care of them in fewer steps.
MontyJ is offline   Reply With Quote
Old 06-21-2017, 12:21 AM   #4
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,718
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by MontyJ View Post
[. . .] so it is still a manual process at that point. Am I missing something the Quality Check plugin can do that will fix the Initials problem?
try this one ==>> Click image for larger version

Name:	1.jpg
Views:	275
Size:	57.2 KB
ID:	157441

BR
BetterRed is offline   Reply With Quote
Old 06-21-2017, 01:26 AM   #5
MontyJ
Addict
MontyJ began at the beginning.
 
Posts: 224
Karma: 10
Join Date: Jul 2012
Device: Kindle
Quote:
Originally Posted by BetterRed View Post
try this one ==>> Attachment 157441

BR
Well, I certainly missed that one! And it works. Fantastic plugin!!

And Thanks!!
MontyJ is offline   Reply With Quote
Advert
Reply


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 and replace in bulk metadata help slantybard Library Management 7 08-20-2015 06:30 PM
regex search/replace - how to? Alt68er Sigil 1 03-11-2014 08:53 PM
Regex search and replace dwlamb Sigil 6 04-12-2013 02:34 PM
regex search/replace Sharlene Sigil 10 01-28-2012 04:14 AM


All times are GMT -4. The time now is 06:33 PM.


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