The regex is not at all right for this task,as you use regex101 on right side it will explain what the regex is doing.
import re test_str = "These books are good.\nThe weather is nice.\nwhere are you going?\nthe car is green" pattern = r'^The\s.*' matches = re.finditer(pattern, test_str, re.MULTILINE) for match in matches: print(match.group())
Output:The weather is nice.
If also want lowercase add re.MULTILINE | re.IGNORECASE
Output:The weather is nice.
the car is green