[Baypiggies] Bug in re module?

Emile van Sebille emile at salesinq.com
Thu Nov 29 20:06:19 CET 2012


Mitch Patenaude wrote:
> Maybe I'm misunderstanding, but I think I have a bug in the re module:
> mpatenaude-mbp:tmp mpatenaude$ python2.7
> Python 2.7.3 (default, Apr 13 2012, 00:05:08) 
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import re
> >>> line="\tTest2.1\n"
> >>> matchobj = re.match('Test2.1',line,0)
> >>> matchobj
>
> It's not matching a very simple string.

Looks like it's matching from the beginning though...

Python 2.5 (r25:51908, Dec 18 2009, 14:22:21)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import re
 >>> line="\tTest2.1\n"
 >>> matchobj = re.match('Test2.1',line,0)
 >>> print matchobj
None
 >>> line="Test2.1\n"
 >>> matchobj = re.match('Test2.1',line,0)
 >>> print matchobj
<_sre.SRE_Match object at 0xb7f69288>
 >>>


If that's a bug I'll let someone more into it declare so.

Emile



More information about the Baypiggies mailing list