demo_regex.py:
import re #Check if the string starts with "The" and ends with "Spain": txt = "The rain in Spain" x = re.search("^The.*Spain$", txt) if (x): print("YES! We have a match!") else: print("No match")
C:\Users\My Name>python demo_regex.py
YES! We have a match!