Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 05-28-2018, 06:56 AM   #1
waalw
Junior Member
waalw began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2018
Device: kobo aura
what ia I doing wrong?

I am trying to make an regexp to get the following items from a filename

series seriesindex - title - author. I made this regexp, but the seriesname and index do not apear. What is missing?

(?P<series>[^_0-9-]*)(?P<series_index>[^_0-9-]*)\s* - (?P<title>[^_]*)\s* - \s*(?P<author>[^_].+) ?

Sample filename = De Donkere Tijd 1 - Schaduwen boven Ullart - Markus Heitz.epub
waalw is offline   Reply With Quote
Old 05-28-2018, 07:19 AM   #2
Nicolas F
Groupie
Nicolas F once ate a cherry pie in a record 7 seconds.Nicolas F once ate a cherry pie in a record 7 seconds.Nicolas F once ate a cherry pie in a record 7 seconds.Nicolas F once ate a cherry pie in a record 7 seconds.Nicolas F once ate a cherry pie in a record 7 seconds.Nicolas F once ate a cherry pie in a record 7 seconds.Nicolas F once ate a cherry pie in a record 7 seconds.Nicolas F once ate a cherry pie in a record 7 seconds.Nicolas F once ate a cherry pie in a record 7 seconds.Nicolas F once ate a cherry pie in a record 7 seconds.Nicolas F once ate a cherry pie in a record 7 seconds.
 
Posts: 161
Karma: 1842
Join Date: Jan 2016
Device: Kobo Glo HD
Quote:
Originally Posted by waalw View Post
I am trying to make an regexp to get the following items from a filename

series seriesindex - title - author. I made this regexp, but the seriesname and index do not apear. What is missing?

(?P<series>[^_0-9-]*)(?P<series_index>[^_0-9-]*)\s* - (?P<title>[^_]*)\s* - \s*(?P<author>[^_].+) ?

Sample filename = De Donkere Tijd 1 - Schaduwen boven Ullart - Markus Heitz.epub
This one seems to work, using \s*-\s* as they do in the example one (\s* stands for 0 or more of any type of space)
(?P<series>[^_0-9-]*)(?P<series_index>[0-9]*)\s*-\s*(?P<title>[^_].+)\s*-\s*(?P<author>[^_-]+)
Nicolas F is offline   Reply With Quote
Advert
Old 05-28-2018, 09:28 AM   #3
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,939
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
you have \s*<a space>-
the \s* gobbles all spaces before the literal space, therefore if fails

Nickolas has it right 0 or more spaces
theducks is offline   Reply With Quote
Reply

Tags
regexp


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I must be doing something wrong hope729 Editor 0 01-15-2016 12:53 PM
Am I doing something wrong? rtgjeg Amazon Kindle 6 12-13-2015 11:46 PM
The Robbery: A Short Story that goes wrong for all the wrong reasons brinlingfm Self-Promotions by Authors and Publishers 0 03-22-2011 08:20 AM
Dates wrong on scheduled news: what am I doing wrong? Rod Laird Calibre 5 11-05-2010 06:06 PM
What did I do wrong? ginag Sigil 3 06-24-2010 05:16 AM


All times are GMT -4. The time now is 01:31 AM.


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