demo_regex_match_span.py:
import re #Search for an upper case "S" character in the beginning of a word, and print its position: str = "The rain in Spain" x = re.search(r"\bS\w+", str) print(x.span())
➜ begtut>python demo_regex_match_span.py
(12, 17)