def expr_match(line, expr):
 if (line == expr):
  return True
 if fnmatch.fnmatch(line, expr):
  return True
 try:
  if re.match('\\A{0}\\Z'.format(expr), line):
   return True
 except re.error:
  pass
 return False

def expr_match ( line , expr ) : if ( line == expr ) : return True if fnmatch . fnmatch ( line , expr ) : return True try : if re . match ( '\\A{0}\\Z' . format ( expr ) , line ) : return True except re . error : pass return False
evaluate a line of text against an expression .