I have this piece of code just for testing regular expressions in Python.
#!/usr/bin/python
import re
line = "(400,71.20,73.40) Cats are smarter than dogs"
matchObj = re.match( r'(\d{3}),(\d{2}.\d{2}),(\d{2}.\d{2})', line,re.I)
if matchObj:
print "matchObj.group() : ", matchObj.group()
print "matchObj.group(1) : ", matchObj.group(1)
print "matchObj.group(2) : ", matchObj.group(2)
else:
print "No match!!"
It's supposed to print 3 groups (400)(71.20)(73.40)
, but instead always prints "No Match!!"
.
Can someone help me?
Thanks in advance