Peter J. Acklam wrote:
That's too general, actually.  There must be a hyphen either both
places or none of them.  The above matches "2003-0619" and
"200306-19".  :-)

Something like this should do the trick (untested)

                    (\d\d\d\d)   # year with century
                    (-?)         # possible hyphen
                    (\d\d)       # month
                    \2           # possible hyphen
                    (\d\d)       # day
                    ...          ...


I did say mine was a very preliminary regex. Your's has the problem that it captures the first hyphen but not the second, so that the array of values is not consistent. Of course, map() could be used to eliminate the evil hyphens...


John


-- 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