def check_regexs(filename, matchers):
 extras = []
 for expressions in matchers:
  (expression, extramatchers) = expressions
  match1 = expression.search(filename)
  if match1:
   for m in extramatchers:
    match2 = m.findall(filename, match1.end())
    if match2:
     for match in match2:
      if ((type(match) == type(())) and (len(match) > 1)):
       extras.append(match[1])
      else:
       extras.append(match)
     break
   return (match1, extras)
 return (None, None)

def check_regexs ( filename , matchers ) : extras = [ ] for expressions in matchers : ( expression , extramatchers ) = expressions match1 = expression . search ( filename ) if match1 : for m in extramatchers : match2 = m . findall ( filename , match1 . end ( ) ) if match2 : for match in match2 : if ( ( type ( match ) == type ( ( ) ) ) and ( len ( match ) > 1 ) ) : extras . append ( match [ 1 ] ) else : extras . append ( match ) break return ( match1 , extras ) return ( None , None )
regular expression match for a list of regexes returns the matchobject if a match is made this version checks for an additional match .