Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Libraries

    Regexp::Common::time 0.01

    Download button

    No screenshots available
    Downloads: 313  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Poor (1.0/5)
    1 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Eric J. Roode | More programs
    Perl Artistic License / FREE
    August 7th, 2007, 20:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    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.

    Product's homepage

    Requirements:

    · Perl
    · Regexp::Common

      


    TAGS:

    date regexps | time regexps | Perl module | date | time | regexps

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM