diff options
author | Fred Drake <fdrake@acm.org> | 2001-03-14 16:18:56 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-03-14 16:18:56 (GMT) |
commit | 62dfed96beb1572134b6165a032cfbaa3882f2f3 (patch) | |
tree | 4e892cc496405276353de3d3f9cc9c86af2cd792 | |
parent | 44d5e0c418b7ec5bc52d9b06a7ad730c82f5bb61 (diff) | |
download | cpython-62dfed96beb1572134b6165a032cfbaa3882f2f3.zip cpython-62dfed96beb1572134b6165a032cfbaa3882f2f3.tar.gz cpython-62dfed96beb1572134b6165a032cfbaa3882f2f3.tar.bz2 |
Change "[%s]" % string.whitespace to r"\s" in regular expressions.
-rw-r--r-- | Lib/sgmllib.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/sgmllib.py b/Lib/sgmllib.py index 1f8f3b8..19580e2 100644 --- a/Lib/sgmllib.py +++ b/Lib/sgmllib.py @@ -33,12 +33,11 @@ endtagopen = re.compile('</[<>a-zA-Z]') endbracket = re.compile('[<>]') special = re.compile('<![^<>]*>') commentopen = re.compile('<!--') -commentclose = re.compile('--[%s]*>' % string.whitespace) +commentclose = re.compile(r'--\s*>') 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]*=[%s]*' % (string.whitespace, string.whitespace)) - + r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./:;+*%?!&$\(\)_#=~]*))?') + r'\s*([a-zA-Z_][-.a-zA-Z_0-9]*)(\s*=\s*' + r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./:;+*%?!&$\(\)_#=~]*))?') # SGML parser base class -- find tags and call handler functions. |