import re text = input("Enter a string: ") # input: Hello World2 print("Contains digits" if re.search(r'\d', text) else "") print("Starts with 'Hello'" if re.match(r'^Hello', text) else "") print("Words found:", re.findall(r'\w+', text)) print("Modified Text:", re.sub(r'\s+', '_', text))