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 :bookworm:.
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: :help:
Tags: fiction / action / suspense - horror,
fiction / fantasy / action - adventure,
Pattern: :chinscratch:
Replace With: :chinscratch:
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: :help: 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: :chinscratch:
Replace With: :chinscratch:
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...
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 :bookworm:.
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: :help:
Tags: fiction / action / suspense - horror,
fiction / fantasy / action - adventure,
Pattern: :chinscratch:
Replace With: :chinscratch:
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: :help: 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: :chinscratch:
Replace With: :chinscratch:
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...