as we know the python '?' quantifier is consider a lazy quantifier and then should gives us the shortest match, but in my example i am getting the second match(second_occurrence), instead of the first match(first_occurrence)
content = "this is how we want that first_occurrence over there but that second_occurrence it is
always wrong when "
match = re.search(r"^this .* that (?P<occurrence>.*?) ", content)
print(match.groupdict())
^(this .* that )(?P<occurrence>.*?)", content) >>> print(match.group(1)) this is how we want that first_occurrence over there but that