View Single Post
Old 03-03-2012, 12:30 PM   #1
geronimo72
Member
geronimo72 began at the beginning.
 
geronimo72's Avatar
 
Posts: 13
Karma: 10
Join Date: May 2011
Device: Kindle Paperwhite
Metadata from filename (regular expressions)

Hi,

sorry for this stupid questions, but I really suck at regular expressions and the default ones in Calibre do not work for me.

I would like to import big collection of books and I would like Calibre to extract the metadata from the filenames. I have following different filenames:
Adams Douglas, Carwardine Mark - Last Chance to See.txt
Adams Douglas - Dirk Gently: The Long Dark Tea Time of the Soul.txt
Adams Douglas - Mostly Harmless.txt

And here are the question:
1. which regular expression do I use to extract both authors from the filename, but it has to work also when there is only one author
2. I would like to have the text which is after "-" as the name of the book and to extract the series and the number of the series from this text also (if there are any)

I was able to change on default Calibre string to extract the second type of filename correctly, but it did not work with the first and the last one. Is there a way to handle these different filenames automatically or do I have to make manual corrections? I can of course change the filenames if it is needed, but it is really a lot of work and I would prefer to solve this by using the regular expression.

I have read also the tutorial for the regular expression, but as already mentioned I suck at it and was unable to use them correctly.

Thank you very much for your help.

Edit: new idea - maybe I can split the books in several groups depending on the filename and use different regular expressions, but I still need help with creating the correct expressions
geronimo72 is offline   Reply With Quote