demo_regex_match.py:
import re #The search() function returns a Match object: str = "The rain in Spain" x = re.search("ai", str) print(x)
➜ begtut>python demo_regex_match.py
<_sre.SRE_Match object; span=(5, 7), match='ai'>