Quote:
Originally Posted by lorijames
I've been looking through the forums trying to find an answer to this one:
I'd like to have my ePub files ONLY be the title. I changed the expression on the advanced tab to (?P<title>.+) pub it's still adding hyphens and the author name. I know I'm missing something, but what?
Lori
|
Okay, I don't have much experience with Calibre, but I do know a lot about regex...
Your expression:
(?P<title>.+) is not quite specific enough. The dot "." acts as a wildcard search character (it can match anything) and the plus "+" acts as a multiplier. So your expression says "Match any character any number of times, and put that into the 'title' container. It's just running a little rampant.
Try something like this:
Here's the explanation (if you care)
(?P<title>
This part says that anything in the parenthesis is going to be put into a container called "<title>" that you can use later. Calibre uses this internally to populate the various fields in it's database.
.+?
This part says "Match any character, repeat that, but do it lazily". The question mark at the end makes a multiplier go lazy, meaning that it will only match as much as it has to. Without the ?, the multiplier goes crazy, and you usually end up matching everything, forever.
) -
This closes the group, and then matches the following space and the dash after that. We need that dash as a way of saying "This isn't part of what I'm looking for" which is why we place it outside of the parenthesis.
This expression work on my completely boring "Book Title - nothing important.txt" filename, but you'll need to see if it fits your needs. This expression will *only* work on file names where the Book Title is the first thing in the file name. I don't have enough experience with knowing how file names are constructed for books yet.