Quote:
Originally Posted by Lokro
I did a lot of searching and couldn't find the answer. I found a regular expression here but I have a small problem with it.
Now I don't think I need anything this crazy.
Code:
(?P<author>((?!\s-\s).)+)\s-\s(?:(?:\[\s*)?(?P<series>.+)\s(?P<series_index>\d+)(?:\s*\])?\s-\s)?(?P<title>[^(]+)(?:\(.*\))?
All of my files are in either two formats depending if it is a series or not
authorlastname, authorfirstname - Seriesname 01 - Title.extension
or
authorlastname, authorfirstname - Title.extension
The above Regular Expression is picking up everything fine but it is adding a whitespace character to Author First name. I can rename my files authorlastname,authorfirstname and it will work fine but I have a good number of files and really don't want to go through and rename them all.
Looking for some help to prevent the whitespace before the Author's First name.
|
There is an option in Calibre in import/export , Adding books to swap firstname lastname.
when the book is
firstname lastname - series 01 - title
you leave it unchecked, when the book filename is
lastname, firstname - series 01 - title
you check it.
Another option is to import everything with the option unchecked and then, at the end of the day do
- select all imported books
- start bulk edit
- start experimental search and replace
- search field
author
- search for
([^ ]+), (.+)
- replace with
\2 \1
I use this import regular expression
Code:
(?P<author>[^-]+)( - (\[|\()?(?P<series>[^-]+)(\[| |\()+(?P<series_index>[0-9]+)(\]|\))?)? - (?P<title>.+)