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