View Single Post
Old 06-16-2013, 01:24 AM   #1
macnab69
Zealot
macnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toys
 
Posts: 129
Karma: 5754
Join Date: Jan 2012
Location: South Africa
Device: Kindle 4
More help needed: regex for add books

There are 2 questions, question 2 being the ideal situation..

Question 1:
If the book has no series, the file format is
author - title
If it does have series, the current format is
author - [series] [series_number] title

If I use this regex
(?P<author>.+) - \[(?P<series>.+)\] \[(?P<series_index>.+)\] (?P<title>[^_]+)
it works if there is a series, but not of there isn't.

How do I fix this?

Question 2:
I would prefer file format to be
author - [series series_number] title
But what if the series name is say Oceans 11, and the book is number 3 in the series. We'd have
author - [Oceans 11 03] - title
This requires a complicated regex, which is entirely beyond me.
macnab69 is offline   Reply With Quote