[Python-Dev] SRE incompatibility
Sjoerd Mullender
sjoerd@oratrix.nl
Tue, 04 Jul 2000 11:55:41 +0200
>>> regexp = '(([a-z]+):)?([a-z]+)$'
>>> import re
>>> re.match(regexp, 'smil').group(0,1,2,3)
('smil', None, 's', 'smil')
>>> import pre
>>> pre.match(regexp, 'smil').group(0,1,2,3)
('smil', None, None, 'smil')
Needless to say, I am relying on the third value being None...
(My regular expression was actually more like
'(?:(?P<prefix>[a-z]+):)?(?P<suffix>[a-z]+)$' and I check for
result.group('prefix'))
-- Sjoerd Mullender <sjoerd.mullender@oratrix.com>