Regex anomaly
Ganesan Rajagopal
rganesan at myrealbox.com
Tue Jan 3 00:19:53 EST 2006
>>>>> mike klaas <mike.klaas at gmail.com> writes:
> In [48]: import re
> In [49]: reStr = r"([a-z]+)://"
> In [51]: against = "http://www.hello.com"
> In [53]: re.match(reStr, against).groups()
> Out[53]: ('http',)
> In [54]: re.match(reStr, against, re.I).groups()
> Out[54]: ('http',)
> In [55]: reCompiled = re.compile(reStr)
> In [56]: reCompiled.match(against).groups()
> Out[56]: ('http',)
> In [57]: reCompiled.match(against, re.I).groups()
> Out[57]: ('tp',)
I can reproduce this on Debian Linux testing, both python 2.3 and python
2.4. Seems like a bug. search() also exhibits the same behavior.
Ganesan
--
Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA
Web: http://employees.org/~rganesan | http://rganesan.blogspot.com
More information about the Python-list
mailing list