(text, regex)
return re.compile(regex).match(doctype.strip()) is not None
Check if the doctype matches a regular expression (if present).
    Note that this method only checks the first part of a DOCTYPE.
    eg: 'html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'
Check if the doctype matches a regular expression (if present).
    Note that this method only checks the first part of a DOCTYPE.
    eg: 'html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'
Check if the doctype matches a regular expression ( if present ) . Note that this method only checks the first part of a DOCTYPE . eg : html PUBLIC - // W3C // DTD XHTML 1 . 0 Strict // EN
def doctype_matches(text, regex):
    """
    Check if the doctype matches a regular expression (if present).
    Note that this method only checks the first part of a DOCTYPE.
    eg: 'html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'
    """
    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