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 file looks like it has a html doctype. """ return doctype_matches(text, r'html\s+PUBLIC\s+"-//W3C//DTD X?HTML.*')