]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix regexp for attrfind; bug reported by Lars Marius Garshol
authorFred Drake <fdrake@acm.org>
Thu, 16 Apr 1998 21:04:26 +0000 (21:04 +0000)
committerFred Drake <fdrake@acm.org>
Thu, 16 Apr 1998 21:04:26 +0000 (21:04 +0000)
<larsga@ifi.uio.no>.

Lib/sgmllib.py

index 035e891e5e0f73cdaebc1a410437061a213839ff..956341c8feabf370f73be4b67249c0188ce8a238 100644 (file)
@@ -30,12 +30,12 @@ endtagopen = re.compile('</[<>a-zA-Z]')
 endbracket = re.compile('[<>]')
 special = re.compile('<![^<>]*>')
 commentopen = re.compile('<!--')
-commentclose = re.compile('--[ \t\n]*>')
+commentclose = re.compile('--[%s]*>' % string.whitespace)
 tagfind = re.compile('[a-zA-Z][a-zA-Z0-9]*')
 attrfind = re.compile(
-    '[ \t\n]+([a-zA-Z_][-.a-zA-Z_0-9]*)'
-    '([ \t\n]*=[ \t\n]*'
-    r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./:+*%?!\(\)_#=~]*))?')
+    '[ \t\n\r]+([a-zA-Z_][-.a-zA-Z_0-9]*)'
+    + ('([%s]*=[%s]*' % (string.whitespace, string.whitespace))
+    r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./:+*%?!\(\)_#=~]*))?')
 
 
 # SGML parser base class -- find tags and call handler functions.