perldoc > DateTime::Format::Builder::Parser::Regex

📛 NAME

DateTime::Format::Builder::Parser::Regex — Regex based date parsing

🚀 Quick Reference

Use CaseCommandDescription
🔧 Create a parser from regex and paramsmy $parser = DateTime::Format::Builder->create_parser( regex => qr/.../, params => [qw( year month day )] );Parses a date string using named captures mapped to DateTime constructor keys
📅 Add default values for missing fieldsextra => { year => 2004, time_zone => "Australia/Sydney" }Supplies default year or timezone when regex doesn't capture them
🏗️ Custom constructor for parsingconstructor => [ 'ClassName', 'method' ] or constructor => sub { ... }Use a custom class/method or coderef to build the DateTime object

🔖 VERSION

version 0.83

📋 SYNOPSIS

my $parser = DateTime::Format::Builder->create_parser(
    regex  => qr/^(\d\d\d\d)(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)$/,
    params => [qw( year month day hour minute second )],
);

📝 SPECIFICATION

In addition to the common keys, "Regex" supports:

🔍 regex

Required. A regular expression that captures elements of the datetime string. Its presence indicates the specification belongs to this class.

📏 params

Required. An arrayref of key names. Captures from the regex are mapped to these ($1 → first element, $2 → second, etc.) and handed to DateTime->new.

➕ extra

Optional. A hashref of extra arguments to DateTime->new. For example, default year or timezone:

extra => { year => 2004, time_zone => "Australia/Sydney" },

🏗️ constructor

Either an arrayref or a coderef.

The method must return a valid DateTime object, or undef on failure.

👀 SEE ALSO

🛠️ SUPPORT

Bugs may be submitted at https://github.com/houseabsolute/DateTime-Format-Builder/issues.

I am also usually active on IRC as 'autarch' on irc://irc.perl.org.

📂 SOURCE

The source code repository for DateTime-Format-Builder can be found at https://github.com/houseabsolute/DateTime-Format-Builder.

👤 AUTHORS

📄 COPYRIGHT AND LICENSE

This software is Copyright (c) 2020 by Dave Rolsky.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

The full text of the license can be found in the LICENSE file included with this distribution.

DateTime::Format::Builder::Parser::Regex
📛 NAME 🚀 Quick Reference 🔖 VERSION 📋 SYNOPSIS 📝 SPECIFICATION
🔍 regex 📏 params ➕ extra 🏗️ constructor
👀 SEE ALSO 🛠️ SUPPORT 📂 SOURCE 👤 AUTHORS 📄 COPYRIGHT AND LICENSE

Generated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-08-06 18:48 @216.73.216.139
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format