Help: re.match puzzle

Vivek Sawant vivek-killspam at cs.unc.edu
Tue Mar 18 21:38:27 CET 2003


I am not able to figure out why re.match is not matching the following 
simple regex.

Python 2.2.2 (#1, Nov 27 2002, 11:14:26)
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import string
 >>> import re
 >>> line = '24 bytes from 128.59.67.201: icmp_seq=1 ttl=56 time=15.2 ms'
 >>> pat = '(?P<time>time=)'
 >>> line
'24 bytes from 128.59.67.201: icmp_seq=1 ttl=56 time=15.2 ms'
 >>> pat
'(?P<time>time=)'
 >>> m = re.match (pat, line)
 >>> print m
None
 >>>

Any ideas?
Thanks.

\vivek





More information about the Python-list mailing list