fork download
  1. import re
  2. sentence = "The Batman has never shown his true identity but has done so much good for Gotham City"
  3. verb = re.findall(r'\bhas\s(?:(?!\bhas\b)[^,."]){0,50}?\bdone\b', sentence)
  4. print(verb)
  5.  
Success #stdin #stdout 0.02s 9688KB
stdin
Standard input is empty
stdout
['has done']