View Single Post
Old 04-16-2016, 10:44 PM   #1
BookFest
Junior Member
BookFest began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Apr 2016
Device: Kindle, iPad
Tag Mapper: Regular Expressions, need help

Hi all,

I apologize in advance for this being one of my first post. I've looked throughout (and Googled in case there was an answer elsewhere) to no avail.

Context:
Calibre has been a Godsend with all the various PDF and other books I've collected along the way. I'm now in the process of tagging and organizing my library. I get most of my tags from Goodreads because they work best for me. I also take ample advantage of the fact that so much can be automated in the program. I'm attempting to do simplify my tagging. In other words, eliminate tags little by little until there is only one per book.

Problem:
What I would like is that if there are several tags, and one specific tag is present, it replaces all of them. Automatically.

For example:
Original: Horror, Science Fiction, Zombies
Result: Horror

Regardless of where Horror is in the list, it always primes.

I've tried: (settings: Replace, Matches pattern)
.*(Horror).*
\1

Also:
(.*?)(Horror)(.*?)
\2

This may seem like a truly dumb request for help to some of you, and I truly looked through both the Calibre help page on Regular Expression and the Python one. But I can't seem to figure that one out.

If any of you could help, it would be truly appreciated. I've spent 2 days trying to figure it out and I'm at my wits end.

Thank you!

Last edited by BookFest; 04-16-2016 at 10:47 PM. Reason: Politeness
BookFest is offline   Reply With Quote