fork download
  1. import re
  2.  
  3. regex = r"\d{2}\/\d{2}\/\d{2}(?:(?!\d{2}\/\d{2}\/\d{2}).)*string(?:(?!string|\d{2}\/\d{2}\/\d{2}).)*\d{2}\/\d{2}\/\d{2}"
  4.  
  5. test_str = """01/20/20\n\n"
  6. "string\n\n"
  7. "01/21/20\n\n"
  8. "01/20/20\n\n"
  9. "this isn't the phrase you're looking for\n\n"
  10. "01/21/20\n\n"
  11. "string"""
  12.  
  13. print(re.findall(regex, test_str, re.DOTALL))
Success #stdin #stdout 0.02s 9752KB
stdin
Standard input is empty
stdout
['01/20/20\n\n"\n\t"string\n\n"\n\t"01/21/20']