]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Change "[%s]" % string.whitespace to r"\s" in regular expressions.
authorFred Drake <fdrake@acm.org>
Wed, 14 Mar 2001 16:18:56 +0000 (16:18 +0000)
committerFred Drake <fdrake@acm.org>
Wed, 14 Mar 2001 16:18:56 +0000 (16:18 +0000)
Lib/sgmllib.py

index 1f8f3b836a19be6c3cf7f2d760f4bf730131f328..19580e25999882155cee602f9ff802d93085849b 100644 (file)
@@ -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.