demo_regex_match_string.py:
import re #The string property returns the search string: str = "The rain in Spain" x = re.search(r"\bS\w+", str) print(x.string)
➜ begtut>python demo_regex_match_string.py
The rain in Spain