|03-18-2012, 03:04 PM||#1|
Join Date: Jul 2011
Replace field with match or empty string?
I want to “replace” a field with a string from the title is it is found, or an empty string if it is not.
I currently have mixed titles like:
Anne McCaffrey - Pern 10 - The Renegades of Pern
The Mystery of Ireta: Dinosaur Planet & Dinosaur Planet Survivors
Anne McCaffrey - Tsw 7 - Ship That Returned
I want to pick out “Pern 10” from the first example, and “Tsw 7” from the fourth example, and write them to the series field. How can I do this?
My current problem is that if there is no match for my group expression, the UI reports an “unmatched group” error, and refuses to proceed.
So how can I create a group that “always matches” but contains an empty string if it’s really not there?
Here is my current, erroneous expression,
The only field I want at the moment is \g<series>
|03-28-2012, 06:28 PM||#2|
Join Date: Mar 2012
Device: Smart Phone
I joined the forums to ask about exactly this same problem, except that I'm using the Find&replace feature of the metadata editor... and if it doesn't find my group in a filename it returns the entire name instead of an empty string; i.e. my regex of
Obviously this is sub-optimal, as in completely useless, so I'd be very grateful for some help.
|03-29-2012, 01:44 AM||#3|
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
You need to do it as 3 passes.
Pass 1 sets JUST the series name
Pass 2 sets the Series_index
Pass 3 consumes the Series and Series index, leaving the remainder in the title
|Thread Tools||Search this Thread|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Regex - replace only part of a string - how?||flameproof||Sigil||11||02-23-2012 05:43 AM|
|Metadata Search & Replace - when it doesn't match||Aldebaranian||Library Management||4||09-28-2011 12:35 PM|
|Variable Search, Replace & Transfer to a new field||flopis||Library Management||10||03-09-2011 12:41 PM|
|Find and replace string with wildcard||jhempel24||Sigil||15||11-12-2010 02:50 PM|
|How to make Author field empty?||khutch||Calibre||1||08-14-2009 03:12 PM|