DateTime::Format::Natural parses currently input strings successfully only if the entire string is a valid expression. It has been proposed that DateTime::Format::Natural also should be able to extract expressions from a string which has parts not belonging to an expression, like:
"see you next tuesday for coffee" -> "next tuesday" The idea is mostly implemented and hence I'm looking for a suitable name of the added public extract method. This method takes a string and given that there are expressions returns in scalar context the first expression, in list context all expressions; if no expressions were found, nothing is returned. The extracted expressions can then be passed to the parse methods. I'm leaning towards naming it extract_datetime(), but nevertheless, I'm thankful for any comments. Attached is the synopsis from the working tree changes. SYNOPSIS use DateTime::Format::Natural; $parser = DateTime::Format::Natural->new; + $date_string = $parser->extract_datetime($extract_string); + @date_strings = $parser->extract_datetime($extract_string); + $dt = $parser->parse_datetime($date_string); @dt = $parser->parse_datetime_duration($date_string); if ($parser->success) { # operate on $dt/@dt, for example: printf("%02d.%02d.%4d %02d:%02d:%02d\n", $dt->day, $dt->month, $dt->year, $dt->hour, $dt->min, $dt->sec); } else { warn $parser->error; } @traces = $parser->trace;