|
|
Thread Tools | Search this Thread |
11-06-2019, 08:24 PM | #1 |
Enthusiast
Posts: 30
Karma: 10
Join Date: Aug 2017
Location: USA
Device: Kobo Clara, Pixel 6 (Moon Reader/Calibre Companion), Amazon Fire 10
|
cannot figure out, please help: bulk metadata swap numeric mo/yr in title w/ regex
I apologize in advance because I think this is a super simple question, but I've been searching for hours and, for the life of me, I cannot seem to figure it out.
I have many periodicals for which I'd like to standardize the date in the title. I already went through and "manually" changed the months from alpha to numeric (e.g., "Jan" to "01"). I now realize that I'd like to also have the year first, followed by the month. So, for instance, I have a bunch of Gardeners' World Magazines, that are currently inputted as: Gardeners' World Magazine, [MONTH] [4 DIGIT YEAR] e.g., "Gardeners' World Magazine, 01 2011" (that is, Jan 2011) I would like to format them as: Gardeners' World Magazine, [4 DIGIT YEAR]/[MONTH] e.g., "Gardeners' World Magazine, 2011/01" BUT I can't figure d**n regex out (even though I find it totally fascinating), specifically how to replace a pattern. I figured out that "\d{2} \d{4}" expresses the date as it is now formatted, which is great, BUT I can't figure out how to transform it to the desired pattern. Please see pic for clarification. Thanks! |
11-06-2019, 08:58 PM | #2 |
Well trained by Cats
Posts: 29,800
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
your search look good
it is your replace you want to use the CAPTURED VALUE (\d{2}) is the first capture (\d{4}) is the second capture Replace wants to USE those, just flipped \2 /\1 |
Advert | |
|
11-06-2019, 09:31 PM | #3 | |
Enthusiast
Posts: 30
Karma: 10
Join Date: Aug 2017
Location: USA
Device: Kobo Clara, Pixel 6 (Moon Reader/Calibre Companion), Amazon Fire 10
|
Quote:
(\d{2}) is the first capture And if so, what is the syntax to show that those should be inverted?(\d{4}) is the second capture I ask because I tried plugging in just (d{2}) (d{4}) for search AND (d{4}) (d{2}) for test and it's not changing anything (in the "your test" field, at least). Really appreciate your help! |
|
11-06-2019, 11:41 PM | #4 |
Well trained by Cats
Posts: 29,800
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
I showed you the PROPER replace for flipping
|
11-07-2019, 12:27 AM | #5 |
Enthusiast
Posts: 30
Karma: 10
Join Date: Aug 2017
Location: USA
Device: Kobo Clara, Pixel 6 (Moon Reader/Calibre Companion), Amazon Fire 10
|
|
Advert | |
|
11-07-2019, 02:36 AM | #6 |
null operator (he/him)
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Yes, the parentheses in the search expression denote capture groups, they're notionally numbered from left to right, and they are referenced in replace expressions with a '\' (sometimes known as backslash or slosh) and number i.e. \1, \2, \3 etc
So, put \2/\1 into the Replace with: box and you'll have yyyy/mm. BR |
Tags |
metadata editor, regex |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Changing metadata(title and author) in bulk/by macro from filename possible? | thosedays | Reading and Management | 0 | 10-20-2016 08:17 AM |
Title sort option failing at bulk metadata edit | Terisa de morgan | Library Management | 2 | 12-21-2015 04:10 AM |
Regex search and replace in bulk metadata help | slantybard | Library Management | 7 | 08-20-2015 06:30 PM |
Bulk Metadata Title Help | braxas | Library Management | 4 | 10-07-2013 03:57 AM |
Regex help pls for bulk editing metadata | manawydan | Library Management | 5 | 06-17-2013 08:22 AM |