fork download
  1. # coding=utf8
  2. # the above tag defines encoding for this document and is for Python 2.x compatibility
  3.  
  4. import re
  5.  
  6. regex = r"(.*?)'s.*((?:\d{2}\/){2}\d{2})"
  7.  
  8. test_str = ("partner1's certificate 'partner certif1' expired on 08/23/17\n"
  9. "partner2's certificate 'partner certif2' expired on 02/14/18")
  10.  
  11. matches = re.finditer(regex, test_str)
  12.  
  13. for match in matches:
  14. print(match.group(1));
  15. print(match.group(2));
  16.  
  17.  
Success #stdin #stdout 0.02s 23304KB
stdin
Standard input is empty
stdout
partner1
08/23/17
partner2
02/14/18