in reply to My code seems messy...

Sorry to be dense, but what types of date strings are you trying to match? I.e.:
Recognize formats: mm-dd-yy, mm-dd-yyyy, mm/dd/yy, MMM-dd, yyyy, etc...?

Are you searching for possible embedded date-strings in a line, or do you know the beginning of the date field and you are trying to parse the date; Any date validity checking?

Would the "Date::Manip", "ParseDate" routine from CPAN be useful?