From: Fred Drake <fdrake@acm.org> Date: Mon, 25 Jan 1999 21:57:07 +0000 (+0000) Subject: Allow recognition of attributes even if they don't have space in front X-Git-Tag: v1.5.2b2~278 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dfd8954e36b997c2f6adfa34df77bab92db6381d;p=python Allow recognition of attributes even if they don't have space in front of them. I.e., '<a name="foo"href="bar.html">' will now have two attributes recognized. Based on comments from newgroup. --- diff --git a/Lib/sgmllib.py b/Lib/sgmllib.py index ffb2ccc348..8d50a88afc 100644 --- a/Lib/sgmllib.py +++ b/Lib/sgmllib.py @@ -35,7 +35,7 @@ commentopen = re.compile('<!--') commentclose = re.compile('--[%s]*>' % string.whitespace) tagfind = re.compile('[a-zA-Z][-.a-zA-Z0-9]*') attrfind = re.compile( - '[%s]+([a-zA-Z_][-.a-zA-Z_0-9]*)' % string.whitespace + '[%s]*([a-zA-Z_][-.a-zA-Z_0-9]*)' % string.whitespace + ('([%s]*=[%s]*' % (string.whitespace, string.whitespace)) + r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./:+*%?!\(\)_#=~]*))?')