View Single Post
Old 05-29-2014, 01:58 PM   #1
myki
Zealot
myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.
 
Posts: 126
Karma: 20236
Join Date: May 2014
Device: Kinde PW v1, Kobo H2O, Onyx Boox T68
Fill fields with filenames

Greetings...

I am trying to fill <series> and <series_index> automatically from filenames.
So i am trying to build a regular expression.

Files are allways named like that :
NAME First-Name - Title-of the book.mobi
or
[Name-of the serie-1.5]Title-of the book.mobi

Sometimes i can find a space after the "]".
Sometimes, 1.5 is written 1,5 and it would be perfect if the code can deal with that

For now, my code looks like that :
Code:
\[(?P<series>.+)\-(?P<series_index>[0-9]+((\.|,|)[0-9]?))?\](?P<title>.+)
It works perfectly for the case [serie-1]title.mobi, but not for author - tile.mobi case.
and if the number is "1,5", it is just ignored.

Can you help me, please ??

Thank you in advance
myki is offline   Reply With Quote