Content deleted Content added
> |
parse to function |
||
Line 30:
[12] = 31
}
function tryParseDate(input)
-- First try dMy
local matchDay, matchMonth, matchYear = input:match('^([0-9][0-9]?) ([A-Za-z]+) ([0-9][0-9][0-9][0-9])$')▼
if (matchDay ~= nil) then
local month = monthIndices[matchMonth:lower()]▼
return { tonumber(matchDay), month, tonumber(matchYear) }
end▼
end
function main.hello(frame)
Line 51 ⟶ 65:
local input = args[1]
local day, month, year = tryParseDate(input)
▲ local matchDay, matchMonth, matchYear = input:match('^([0-9][0-9]?) ([A-Za-z]+) ([0-9][0-9][0-9][0-9])$')
if (matchDay == nil) then return input .. ' -> is not a recognized pattern match' end▼
▲ local month = monthIndices[matchMonth:lower()]
▲ if (month == nil) then return input .. ' -> does not have a recognized month name' end
if (year < 1760) then
|