s = ("If I’m not in a hurry, then I should stay. " +
"On the other hand, if I leave, then I can sleep.")
re.findall(r'[Ii]f (.*), then', s)
The output is:
I’m not in a hurry, then I should stay. On the other hand, if I leave
The question is: Why aren't the words "If" and "then" not included in the output?
Something like this:
If I’m not in a hurry, then I should stay. On the other hand, if I leave, then