Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit de2f708

Browse files
committed
Fix regexp for attrfind; bug reported by Lars Marius Garshol
<[email protected]>.
1 parent 77d1fce commit de2f708

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Lib/sgmllib.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
endbracket = re.compile('[<>]')
3131
special = re.compile('<![^<>]*>')
3232
commentopen = re.compile('<!--')
33-
commentclose = re.compile('--[ \t\n]*>')
33+
commentclose = re.compile('--[%s]*>' % string.whitespace)
3434
tagfind = re.compile('[a-zA-Z][a-zA-Z0-9]*')
3535
attrfind = re.compile(
36-
'[ \t\n]+([a-zA-Z_][-.a-zA-Z_0-9]*)'
37-
'([ \t\n]*=[ \t\n]*'
38-
r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./:+*%?!\(\)_#=~]*))?')
36+
'[ \t\n\r]+([a-zA-Z_][-.a-zA-Z_0-9]*)'
37+
+ ('([%s]*=[%s]*' % (string.whitespace, string.whitespace))
38+
+ r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./:+*%?!\(\)_#=~]*))?')
3939

4040

4141
# SGML parser base class -- find tags and call handler functions.

0 commit comments

Comments
 (0)