View Single Post
Old 08-29-2011, 04:12 PM   #2
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by txckie View Post
I am using this regex at the moment:
" ^(?P<author>((?!\s-\s).)+)\s-\s(??:\[\s*)?(?P<series>.+)\s(?P<series_index>[\d\.]+)(?:\s*\])?\s-\s)?(?P<title>[^(]+)(?:\(.*\))? "

I now need to add publisher to my regex. My books are in this format

Author - [Series Series Index] - Title [Publisher](epub).epub

Example:
JR Ward - [Black Dagger Brotherhood 03] - Lover Awakened [Signet] (epub).epub

Any help would be appreciated.
What are you looking for - a regex that captures the exact book filename format above, a regex that captures many variations of that format or a regex that captures many variations of book filenames based specifically on your regex above? Part of what is confusing is that you are using a lot of non-capturing parentheticals and it's not clear why. You don't usually need to use non-capturing parentheticals. Calibre wil ignore any matches not inside the labeled parentheses. You are also using many "?" specifiers for optional matching - again it's not clear why unless you post some of the variations you need to match.

You can try just dropping \s\[(?P<publisher>.*+\]\s in after your title.
Starson17 is offline   Reply With Quote