1
txt = 'Teena is Positive. Sara is Negative'
reg = re.compile(r'(Teena|Sara).*(Positive|Negative)')
result = re.search(reg, txt).group(1)
print(result)

This returns 'Negative' while I expected 'Positive'. I assumed that the first match is returned. What am I doing wrong??

dratoms
  • 159
  • 11

0 Answers0