View Single Post
Old 04-12-2016, 02:55 PM   #1
jecilop
Addict
jecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day now
 
Posts: 260
Karma: 139980
Join Date: Mar 2014
Device: Android
Help: Tag Mapper and RegExpressions

SOLVED as of post #16.

I need some help properly coding a Replace/Pattern rule. If you can or will provide input, I REALLY appreciate it.

Kovid provided some help when I requested the feature. I didn't realize it was already there, but it's definitely not intuitive. He gave me a link to the types of expressions I would need to use ( http://manual.calibre-ebook.com/regexp.html ), but I find it overwhelming and cannot put two and two together on it. I HAVE TRIED .

I have two situations noted below that I want to set up in rules. (I included a 3rd that he helped with for reference). If you know how, PLEASE provide the correct string needed for the "Replace if matches pattern" rule. Please do not provide just a guess as that can mess everything up as soon as I test it unless I create a separate library.
If I can get these, I think I can better learn more of this as I know there will be other patterns I'll want to work with.

Pattern 1: (solution provided by Kovid)
Tags: FIC098098, FIC090909, FIC######
Pattern: FIC([0-9]+)
Replace With: FICTION, \1
Yields: FICTION, 098098, 090909, etc.....
I just replaced with FICTION only and decided to eliminate the unnecessary numbers instead.

Pattern 2:
Tags: fiction / action / suspense - horror,
fiction / fantasy / action - adventure,
Pattern:
Replace With:
GOAL/Yields: fiction, action, suspense - horror, fantasy, action - adventure
Essentially, I want to turn the "Space/Space" into a comma which creates separate tags. I ONLY want this where a / exists with a space either before or after and NOT with a character of any sort next to it like "fiction/action/suspense". This would STAY "fiction/action/suspense" .

Pattern 3: although I MIGHT be able to figure this one out if I have a solution to Pattern 2.
Tags: action & adventure, science & fantasy, mystery & crime, thriller & horror
Pattern:
Replace With:
GOAL/Yields: action, adventure, science, fantasy, mystery, crime, thriller, horror (ie, separate tags)
As in Pattern 2: ONLY "Space&Space" would be replace with a comma to make separate tags. If "&" is used WITHOUT a space before or after, then I don't want that changed (ie, walk&run stays walk&run)

Thanks ahead of time if you can...

Last edited by jecilop; 04-14-2016 at 08:11 PM. Reason: UPDATE
jecilop is offline   Reply With Quote