View Single Post
Old 09-23-2014, 10:48 PM   #1
kite
enturbulated
kite can tell if an avocado is ripe without touching it.kite can tell if an avocado is ripe without touching it.kite can tell if an avocado is ripe without touching it.kite can tell if an avocado is ripe without touching it.kite can tell if an avocado is ripe without touching it.kite can tell if an avocado is ripe without touching it.kite can tell if an avocado is ripe without touching it.kite can tell if an avocado is ripe without touching it.kite can tell if an avocado is ripe without touching it.kite can tell if an avocado is ripe without touching it.kite can tell if an avocado is ripe without touching it.
 
kite's Avatar
 
Posts: 30
Karma: 130494
Join Date: May 2007
Device: Kobo Aura HD
regex for filename with muliple dots? (adding books)

SOLVED Trying to get a regex for filename with variable number of dots (<2).

I get the following from the tutorial and other threads, (thanks to Starson17 for all your generous contributions):
Untick, "Read metadata from file contents rather than file name"
and the regular expression
Firstauthorname SurnameAuthor - Title.pdf
works with
(?P<author>[^_]+) - (?P<title>.+)
while
Firstauthorname SurnameAuthor. Title.pdf
works with
(?P<author>[^_]+)\. (?P<title>.+)

However
Firstauthorname SurnameAuthor. Title A. Title B. Title C. Title D. Volume 2..pdf
doesn't work with anything I can find.

I want everything between the first "dot white space" and ".pdf" to be read as the title.

Real life example of file name:
Dionysius of Halicarnassus. Roman Antiquities, IV. Books VI.49-VII.pdf

How do I modify
(?P<author>[^_]+)\. (?P<title>.+)
so it ignores special characters after the first dot?

Last edited by kite; 09-28-2014 at 09:13 AM. Reason: problem solved
kite is offline   Reply With Quote