Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 08-03-2018, 02:56 AM   #1
melba.d
Junior Member
melba.d began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Aug 2018
Device: paperwhite
Move date from beginning to end of title w/ regex?

Hi, I have several titles that include a date at the beginning of the title that I'd like to move to the end. So...

2018-07-01 The Title
to
The Title 2018-07-01

All dates are in this format. Seems like this should be relatively straightforward using Bulk Edit Metadata, but I can't wrap my head around how to make it happen.

Last edited by melba.d; 08-03-2018 at 03:01 AM. Reason: clarification
melba.d is offline   Reply With Quote
Old 08-03-2018, 03:42 AM   #2
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 23,036
Karma: 41963189
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
You should be able to get away with:

Search for: (.*?)\s(.*)
Replace with: \2 \1

But, if you accidentally select a title that doesn't have the date, you will mess it up.

So, safer is:

Search for: ([\d-]+)\w(.*)
Replace with: \2 \1

That looks like it won't mess with titles that don't have the date at the start. Unless you have something like "101 Ways to Write Regex in calibre".

And use title for both the Search and destination fields.
davidfor is offline   Reply With Quote
Advert
Old 08-04-2018, 02:58 AM   #3
melba.d
Junior Member
melba.d began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Aug 2018
Device: paperwhite
Quote:
Originally Posted by davidfor View Post
You should be able to get away with:

Search for: (.*?)\s(.*)
Replace with: \2 \1

But, if you accidentally select a title that doesn't have the date, you will mess it up.

So, safer is:

Search for: ([\d-]+)\w(.*)
Replace with: \2 \1

Ohhhh, I see what I did wrong. I tried to match just the date but then couldn't figure out what to put in the replace field to make it work. Now I see you need to match both parts and then switch them. Thank you, this was so helpful and now I understand regex slightly better!
melba.d is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
RegEx-Putting pub. date after first sentence in title if two or more sentenced title font332 Library Management 0 08-17-2017 09:49 AM
Sorting: Same title beginning, shorter title first Under the Covers Calibre 14 05-04-2015 11:18 PM
Regex to search at beginning of line kakkalla Sigil 30 06-03-2013 04:08 PM
How to move toc go the beginning of epub file IanSR ePub 15 05-04-2013 10:22 PM
Bulk move 'The' and 'A' to end of Title macnab69 Library Management 3 01-28-2013 10:26 AM


All times are GMT -4. The time now is 02:42 PM.


MobileRead.com is a privately owned, operated and funded community.