Code Monkey home page Code Monkey logo

regexp-common-time's Introduction

Regexp::Common::time v0.09
==========================

This is a Regexp::Common plugin that provides regular expressions for
parsing dates and times.  It can handle most date formats, such as:

      y/m/d               m/d/y               d/m/y
    2005/04/02          4/2/2005            2/4/05
    05.04.02            04.02.05            02.04.2005
    2005 April 2        April 2, 2005       2 APR 05
    05APRIL02           APR022005           02 April 2005
    20050402            040205              02042005

      ISO 8601            RFC 2822
  2008-05-24T21:46:01   25 May 2008 21:46:01 +0500


It can also handle time formats like:

    9:03:27pm
    21:03:27
    9:03 p.m.
    21:03
    9:03a

Furthermore, you can easily piece together time and date component
patterns (in the style of Time::Format or POSIX's strftime) to build
arbitrarily complex custom regexes that can parse just about any time
or date pattern imaginable.


INSTALLATION

To install this module type the following:

   perl Makefile.PL
   make
   make test
   make install

On Windows, you will need to use nmake instead of make.


DEPENDENCIES

This module requires this other modules and libraries:

  Regexp::Common
  POSIX (optional)
  I18N::Langinfo (optional, but needed for internationalization)

Also, Time::Normalize is likely to be useful to you.


COPYRIGHT AND LICENSE

Eric J. Roode, roode @ cpan . org

Copyright (c) 2005-2008 by Eric J. Roode. All Rights Reserved.
This module is free software; See the copyright notice in the
module source code for full details.

To avoid my spam filter, please include "Perl", "module", or this
module's name in the message's subject line, and/or GPG-sign your
message.

regexp-common-time's People

Contributors

jjatria avatar manwar avatar mishin avatar szabgab avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

mishin jjatria

regexp-common-time's Issues

Tests fail on perls before 5.12

t/american.t depends on the 'unicode_strings' feature, which is a 5.12+ feature, but META for this module indicates support for perls 5.6 and up.

 $ prove -v t/american.t 
t/american.t .. Feature "unicode_strings" is not supported by Perl 5.10.1 at t/american.t line 4.
BEGIN failed--compilation aborted at t/american.t line 4.
Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run 

Test Summary Report
-------------------
t/american.t (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: No plan found in TAP output
Files=1, Tests=0,  0 wallclock secs ( 0.01 usr +  0.01 sys =  0.02 CPU)
Result: FAIL

this would additionally fail on perls without feature in core (perls before 5.9.3)

ISO8601 datetimes must use a separator for both date and time, or neither

Hi Mohammed,

The ISO spec states that either both the date and time must have a separator, or neither may have it.

However this module matches a non-conformant date:

$ perl -MRegexp::Common=time -wE 'say $RE{time}{iso}->matches("1901-02-03T040506")'

1

On the other hand DateTime::Format::ISO8601 rejects the date:

$ perl -MDateTime::Format::ISO8601 -wE 'say DateTime::Format::ISO8601->parse_datetime("1901-02-03T040506")->datetime;'

Invalid date format: 1901-02-03T040506 at -e line 1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.