import re s = "Welcome to Softhunt" # here x is the match object res = re.search(r"S", s) print(res.re) print(res.string)