View Single Post
Old 09-27-2011, 05:39 AM   #1
ZaMotH
Junior Member
ZaMotH began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Sep 2011
Device: IQ pocketbook
Importing Ebooks, regexp confusion

Hi all,
I'm trying to import fields from formated files to import to calibre.

here is the regexp I'm trying to make work :
((?P<series>.+) # (?P<series_index>.+) - |)(?P<title>.+)( \[(?P<author>.+)\]|)

If it belong to a series, then my filename will start by :
- "**Serie name** # **Serie number ** - "

There might not be a serie name, so after this, comes the title :
- **title**

And afterwards, I add authors, but not always :
- "[**author**]"

Here is a sample of one of the titles I'm willing to parse :
Serie Name # 01 - Title name [author1 & Author2].epub

This Works : ((?P<series>.+) # (?P<series_index>.+) - |)(?P<title>.+)
This Works if there is a title : (?P<title>.+) \[(?P<author>.+)\]

But this : ((?P<series>.+) # (?P<series_index>.+) - |)(?P<title>.+)( \[(?P<author>.+)\]|)
Always gives up the following error : Attribute editor :'Nonetype' object has no attribute replace

Can anyone help ?

Regards
ZaMotH is offline   Reply With Quote