def re_meta(line, match=None):
 if match:
  reStr = re.compile(u'^\\.\\. {0}: (.*)'.format(re.escape(match)))
 else:
  reStr = re.compile(u'^\\.\\. (.*?): (.*)')
 result = reStr.findall(line.strip())
 if (match and result):
  return (match, result[0])
 elif ((not match) and result):
  return (result[0][0], result[0][1].strip())
 else:
  return (None,)

def re_meta ( line , match = None ) : if match : reStr = re . compile ( u'^\\.\\. {0}: (.*)' . format ( re . escape ( match ) ) ) else : reStr = re . compile ( u'^\\.\\. (.*?): (.*)' ) result = reStr . findall ( line . strip ( ) ) if ( match and result ) : return ( match , result [ 0 ] ) elif ( ( not match ) and result ) : return ( result [ 0 ] [ 0 ] , result [ 0 ] [ 1 ] . strip ( ) ) else : return ( None , )
find metadata using regular expressions .