Project

General

Profile

Actions

Bug #11436

closed

Date parsing probably doesn't match for the longest regular expression

Added by draganglumac (Dragan Glumac) over 8 years ago. Updated almost 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:<unknown>]

Description

If you parse a string 'Edinburg Fringe' with the Date::parse method, you'll get the date of next Friday in Edinburgh time zone.

Some of our tests are failing for this reason. I expect that parse is matching the argument via a regular expression, but it's greedy so perhaps RegEx needs a minor update.

In any case, if you wanted to reproduce this defect I've attached the script.

Hope that helps

Dragan


Files

edinburgh_fringe.rb (183 Bytes) edinburgh_fringe.rb draganglumac (Dragan Glumac), 08/12/2015 09:12 AM
Actions #1

Updated by draganglumac (Dragan Glumac) over 8 years ago

I've realised that that there are methods on the date like strptime which give me a fine-grained control of the date parsing, so maybe this catch-all parse method is greedy by design.

Perhaps it could just be mentioned in the documentation for the parse method as a warning to the unwary (if it hasn't been already).

Actions #2

Updated by jeremyevans0 (Jeremy Evans) almost 5 years ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0