Regexp::Common::time

Regexp::Common::time Perl module contains date and time regexps.
Download

Regexp::Common::time Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Eric J. Roode
  • Publisher web site:
  • http://search.cpan.org/~roode/

Regexp::Common::time Tags


Regexp::Common::time Description

Regexp::Common::time Perl module contains date and time regexps. Regexp::Common::time Perl module contains date and time regexps.SYNOPSIS use Regexp::Common qw(time); # Piecemeal, Time::Format-like patterns $RE{time}{tf}{-pat => 'pattern'} # Piecemeal, strftime-like patterns $RE{time}{strftime}{-pat => 'pattern'} # Match ISO8601-style date/time strings $RE{time}{iso} # Fuzzy date patterns # YEAR/MONTH/DAY $RE{time}{ymd} # Most flexible $RE{time}{YMD} # Strictest (equivalent to y4m2d2) # Other available patterns: y2md, y4md, y2m2d2, y4m2d2 # MONTH/DAY/YEAR (American style) $RE{time}{mdy} # Most flexible $RE{time}{MDY} # Strictest (equivalent to m2d2y4) # Other available patterns: mdy2, mdy4, m2d2y2, m2d2y4 # DAY/MONTH/YEAR (European style) $RE{time}{mdy} # Most flexible $RE{time}{MDY} # Strictest (equivalent to d2m2y4) # Other available patterns: dmy2, dmy4, d2m2y2, d2m2y4 # Fuzzy time pattern # HOUR/MINUTE/SECOND $RE{time}{hms} # H: matches 1 or 2 digits; 12 or 24 hours # M: matches 2 digits. # S: matches 2 digits; may be omitted # May be followed by "a", "am", "p.m.", etc.This module creates regular expressions that can be used for parsing dates and times. See Regexp::Common for a general description of how to use this interface.Parsing dates is a dirty business. Dates are generally specified in one of three possible orders: year/month/day, month/day/year, and day/month/year. Years can be specified with four digits or with two digits (with assumptions made about the century). Months can be specified as one digit, two digits, as a spelled-out name, or as a three-letter abbreviation. Day numbers can be one digit or two digits, with limits depending on the month (and, in the case of February, even the year). Also, different people use different punctuation for separating the various elements.A human can easily recognize that "October 21, 2005" and "21.10.05" refer to the same date, but it's tricky to get a program to come to the same conclusion. This module attempts to make it possible to do so, with a minimum of difficulty.If you know the exact format of the data to be matched, use one of the specific, piecemeal pattern builders: tf or strftime. If there is some variability, use one of the fuzzy-matching patterns in the dmy, mdy, or ymd families. If the data are wildly variable, such as raw user input, give up and use the Date::Manip or Date::Parse module.Time values are generally much simpler to parse than date values. Only one fuzzy pattern is provided, and it should suffice for most needs. Requirements: · Perl · Regexp::Common


Regexp::Common::time Related Software