Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 08-28-2011, 04:23 AM   #1
txckie
Junior Member
txckie began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Aug 2011
Device: Panditigal Novel
New help with a regex

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.
txckie is offline   Reply With Quote
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
Advert
Old 08-29-2011, 08:46 PM   #3
txckie
Junior Member
txckie began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Aug 2011
Device: Panditigal Novel
I have books in several different formats. This regex seems to cover most of them. Examples:

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

I got it from an example on this forum. It is not my own but it seems to work better than the ones I was originally using. I had to switch back and forth between them to make them work and they didn't work for all my files.

(?P<author>[^_]+) - (?P<title>.+)
(?P<author>[^_]+) - (?P<series>[^-]+) (?P<series_index>[^-]+) - (?P<title>.+)

Thanks so much for your help
txckie is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
regex help please thevoiceofcheese Calibre 2 08-01-2011 11:27 PM
Regex Faster Sigil 2 04-24-2011 09:08 PM
What a regex is Worldwalker Calibre 20 05-10-2010 05:51 AM
Help with a regex A.T.E. Calibre 1 04-05-2010 07:50 AM
Regex help... Bobthebass Workshop 6 04-26-2009 03:54 PM


All times are GMT -4. The time now is 03:39 AM.


MobileRead.com is a privately owned, operated and funded community.