Ben Bennett wrote:
However, I think that the default format (if nothing was specified)
should allow for parsing of common ISO8601 formats.


When I made a very simple attempt at this back in January, I limited myself to the most basic format:


    if ( @date =
        ( $val =~ /(\d\d\d\d)   # year with century
                    -?          # possible hyphen
                   (\d\d)       # month
                   -?           # possible hyphen
                   (\d\d)       # day
                   (?:T         # time is optional
                     (\d\d)     # hours
                     :(\d\d)    # minutes
                     (?:        # seconds are optional
                      :(\d\d)   # seconds
                     )?
                   )?
                  /x
        )
    ) {


It should be possible to walk through a chain of more and more rococo regexes (and even build a regex based on user-supplied information).


John

p.s. you are welcome to my code, but it is really a primitive proof of concept rather than anything useful.

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD  20706
301-459-3366 x.5010
fax 301-429-5748



Reply via email to