Quantcast
Channel: MobileRead Forums - Conversion
Viewing all articles
Browse latest Browse all 3902

REGEX And Dates

$
0
0
Hi,

I'm using the following regex to interpret the book titles created by my partner.

(?P<title>[^-]*) - (?P<author>[^-]*) - (?P<series>[^-]*) - (?P<publisher>[^-]*) - (?P<published>.*)


This will interpret a title such as the following:

Lavender - Felicity Harper - Enchanting Tales - Endeavours Partnership - 02-03-2017.odt


However, I have noticed that if the day portion of the date contains the digit 1, then the date will not be displayed in the Published metafield properly in the regex testing screen.

01-03-207 is reported as 02-03-2017 and 31-03-207 is reported as 30-03-2017.

It does not matter which month I substitute. It does not matter whether I enter the date as YY-MM-DD or DD-MM-YYY or DD-MMM-YYYY. That it is a date is recognised but, for some reason, 1 and 31 are never pattern-matched.

Is this me doing something wrong (I am no expert at regex!) or have I just discovered a bug?

Many thanks in advance for any insights anyone can offer!

Thomas.

Viewing all articles
Browse latest Browse all 3902

Trending Articles