dateparser is a smart and high-performance date parser library, it supports hundreds of different formats, nearly all format that we may used. And this is also a showcase for "retree" algorithm.
Hi, I'm trying to parse dates in a format of month-year. This format without a day is very common for documents like CV. But I found that I cannot add a custom rule e.g. for the following dates:
I added custom rules and checked that these must be working fine as a common Regex. But I'm getting an error Text september 2010 cannot parse at 12. The reason is, in the code:
private void DateParser::parse(final CharArray input) {
matcher.reset(input);
int offset = 0;
int oldEnd = -1;
while (matcher.find(offset)) {
// ....
}
if (offset != input.length()) {
throw error(offset);
}
}
every time I see matcher.re() is equal to (?<month>september)\W+(?<day>\d{1,2})(?:th)?\W* with offset equal to 12 instead of 14 and, definitely, this doesn't cover whole template.
Is any way to force matching by a longest match instead of taking first one? Or give a bunch of matches instead of a total break?
Hi, I'm trying to parse dates in a format of month-year. This format without a day is very common for documents like CV. But I found that I cannot add a custom rule e.g. for the following dates:
I added custom rules and checked that these must be working fine as a common Regex. But I'm getting an error
Text september 2010 cannot parse at 12
. The reason is, in the code:every time I see
matcher.re()
is equal to(?<month>september)\W+(?<day>\d{1,2})(?:th)?\W*
withoffset
equal to 12 instead of 14 and, definitely, this doesn't cover whole template.Is any way to force matching by a longest match instead of taking first one? Or give a bunch of matches instead of a total break?