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-23-2014, 12:56 PM   #1
comox
Enthusiast
comox began at the beginning.
 
Posts: 36
Karma: 10
Join Date: Jan 2011
Device: none
regular expression to convert character when adding book

Hoping there might be a regular expression expert that can help me.

I would like to convert "_" to ":" in the file name title when adding books.

For example:
John Doe - Cooking_ With Gas - 2014

Using:
(?P<author>[^_]+) - (?P<title>.+) - (?P<published>.+)

Is there a modification I can make so that the imported title is "Cooking: With Gas".
comox is offline   Reply With Quote
Old 08-23-2014, 01:51 PM   #2
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 15,269
Karma: 6022733
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by comox View Post
Hoping there might be a regular expression expert that can help me.

I would like to convert "_" to ":" in the file name title when adding books.

For example:
John Doe - Cooking_ With Gas - 2014

Using:
(?P<author>[^_]+) - (?P<title>.+) - (?P<published>.+)

Is there a modification I can make so that the imported title is "Cooking: With Gas".
colon is a reserved filesystem character.
C:
LPT1:
NUL:
theducks is online now   Reply With Quote
Old 08-23-2014, 01:55 PM   #3
comox
Enthusiast
comox began at the beginning.
 
Posts: 36
Karma: 10
Join Date: Jan 2011
Device: none
Thanks. I understand colon is reserved. That's why ":" was converted to "_" when saving the title in the filename. I would like to reverse the process and convert "_" to ":" when adding a book to my library.
comox is offline   Reply With Quote
Old 08-23-2014, 01:57 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,438
Karma: 5383257
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You cannot run regular expression on filenames while importing, you can run them in bulk via the search replace tab of the bulk metadata edit dialog, after importing.
kovidgoyal is offline   Reply With Quote
Old 08-23-2014, 02:15 PM   #5
comox
Enthusiast
comox began at the beginning.
 
Posts: 36
Karma: 10
Join Date: Jan 2011
Device: none
got it, thanks
comox 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
Calibre book adding: Regular expression request... Spiffy Calibre 29 09-12-2011 11:59 AM
Regular Expression adding book published date jbcmars Calibre 2 01-08-2011 10:23 PM
Adding Books, regular expression smarties86 Calibre 4 12-19-2010 09:18 AM
Regular Expression on adding books. Lokro Calibre 4 11-06-2010 12:05 PM
Regular Expression For Adding Books jhart711 Calibre 3 09-27-2010 07:51 AM


All times are GMT -4. The time now is 05:21 PM.


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