I'm matching a SQL date like this:
   $ftime =~ /(\d+)-(\d+)-(\d+)\s+(\d+):(\d+):(\d+)/;
 
If $ftime is "2001-05-13 11:53:00", then $1 is "2001", $2 is "05", etc.
 
However, I also want to match if the user types in a partial string.  For
example, if $ftime is "2001-12-18", I want $1, $2 and $3 to be "2001", "12"
and "18" but $4 to be null.  In reality, my regex fails entirely and $1 is
null.
 
How can I get $1, $2, $3, $4, $5 and $6 to contain as many matches as my
input string has?  Do I have to use 6 separate regexes?

_______________________________________________________
Stephan Gross       Loral Skynet     908-470-2388     [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> 

 

Reply via email to