in reply to Re: negative look-ahead is ignored
in thread negative look-ahead is ignored

I always try to keep my questions as short as possible!
So they often do not describing the true issue
Anyway, I get your point, but in my case, in which I've written a 'generic date parser/converter' I don't really want to use ^ and $, it would limit the number of possible date formats, for example
"2005-031" " 2005-31" "2005031 " "|2005-031 12:11:22| " "Some time ago 1776-07-04 ....."
And I'm not even started to scratch the surface of what my 'generic date parser/converter' can do more :)

Thnx
LuCa

Replies are listed 'Best First'.
Re^3: negative look-ahead is ignored
by Moron (Curate) on Feb 19, 2007 at 17:07 UTC
    In that case I would be inclined to maintain a list of regexps - one for each allowable format - rather than (I predict) torturing one into handling successive new requirements until it finally dies in an agony of unmaintainability. I might even put them in a configuration file rather than code for easy update in production environments, load and chop them them into an array and then try them out successively on the data until a match is found or the possible formats exhausted.

    -M

    Free your mind

Re^3: negative look-ahead is ignored
by bsdz (Friar) on Feb 19, 2007 at 23:18 UTC
    You probably already know about Date::Manip. It has a function ParseDateString that should do some of what you want.
      I don't know Date::Manip that well, but I think that the reason I once started with a date parser was because of problems related to epoch seconds and milliseconds.
      But I guess I can improve my module if I would use Date::Manip!
      Thanks for the suggestion!

      LuCa