def doctype_matches(text, regex):
 m = doctype_lookup_re.match(text)
 if (m is None):
  return False
 doctype = m.group(2)
 return (re.compile(regex).match(doctype.strip()) is not None)

def doctype_matches ( text , regex ) : m = doctype_lookup_re . match ( text ) if ( m is None ) : return False doctype = m . group ( 2 ) return ( re . compile ( regex ) . match ( doctype . strip ( ) ) is not None )
check if the doctype matches a regular expression .