def check_for_date(filename, matcher):
 x = 0
 if matcher:
  for expression in matcher:
   regex = re.compile(expression)
   match1 = regex.search(filename)
   x += 1
   if match1:
    return (match1, x)
 return (None, 0)

def check_for_date ( filename , matcher ) : x = 0 if matcher : for expression in matcher : regex = re . compile ( expression ) match1 = regex . search ( filename ) x += 1 if match1 : return ( match1 , x ) return ( None , 0 )
regular expression match for date based files returns the matchobject if a match is made .