I need help finding a substring using regex, starting with an example:
Given the following string:
test_str = "start: 1111 kill 22:22 start: 3333 end"
I would like to extract the string between start and end that doesn't involve kill:
wanted_result = (start: 3333 end)
Note: I need to get all matches of start blablab end that don't have kill between them
Several tries failed, the latest one:
pattern = re.compile(r'start:(.+?)(([^kill])end)',flags = re.DOTALL)
results = pattern.findall(test_str)
which results in a different result:
result = (' 1111 kill 22:22 start: 3333', ' end', ' end')