From 1fef18118339237de025ed15dc6df4c39315b55d Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 23 Oct 1997 19:09:21 +0000 Subject: Although it's hard to be sure, I *think* this is a working conversion from regex to re style regular expressions. This should make sgmllib and htmllib threadsafe, so I can now create a threaded version of webchecker... --- Lib/sgmllib.py | 134 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/Lib/sgmllib.py b/Lib/sgmllib.py index 8f32001..8baf519 100644 --- a/Lib/sgmllib.py +++ b/Lib/sgmllib.py @@ -8,34 +8,34 @@ # and CDATA (character data -- only end tags are special). -import regex +import re import string # Regular expressions used for parsing -interesting = regex.compile('[&<]') -incomplete = regex.compile('&\([a-zA-Z][a-zA-Z0-9]*\|#[0-9]*\)?\|' - '<\([a-zA-Z][^<>]*\|' - '/\([a-zA-Z][^<>]*\)?\|' - '![^<>]*\)?') - -entityref = regex.compile('&\([a-zA-Z][a-zA-Z0-9]*\)[^a-zA-Z0-9]') -charref = regex.compile('&#\([0-9]+\)[^0-9]') - -starttagopen = regex.compile('<[>a-zA-Z]') -shorttagopen = regex.compile('<[a-zA-Z][a-zA-Z0-9]*/') -shorttag = regex.compile('<\([a-zA-Z][a-zA-Z0-9]*\)/\([^/]*\)/') -endtagopen = regex.compile('a-zA-Z]') -endbracket = regex.compile('[<>]') -special = regex.compile(']*>') -commentopen = regex.compile('