import re
matchObj = re.search(r"[regex_str]*", "match_str")
if matchObj:
print("matchObj.group() : {}".format(matchObj.group()))
print("matchObj.group(1) : {}".format(matchObj.group(1)))
print("matchObj.group(2) : {}".format(matchObj.group(2)))
else:
print("No match!!")
|