fork(1) download
  1. import re
  2. rx1 = re.compile(r'^\d+\.\d+\.\d+-\w')
  3. rx2 = re.compile(r'^\d+\.\d+\.\d+$')
  4. def extraction(parentTag):
  5. return [x for x in parentTag if any(rx1.match(e) for e in x) or not any(rx2.match(e) for e in x)]
  6.  
  7. expected_input = [
  8. ['419adf7', '1.0.22-SNAPSSHOT'],
  9. ['1.0.24', '82e13c1', 'master'],
  10. ['1.0.25-1618314650'],
  11. ['1.0.10', '7ad4886'],
  12. ['1.0.13-1589279873', 'e597811'],
  13. ['73a3788'],
  14. ]
  15.  
  16. expected_input = extraction(expected_input)
  17. print(expected_input)
  18. #Current Output = [['1.0.25-1618314650'], ['1.0.13-1589279873', 'e597811']]
  19. #Expected Output = [['1.0.25-1618314650'], ['1.0.13-1589279873', 'e597811'], ['419adf7', '1.0.22-SNAPSSHOT'], ['73a3788']]
Success #stdin #stdout 0.02s 9388KB
stdin
Standard input is empty
stdout
[['419adf7', '1.0.22-SNAPSSHOT'], ['1.0.25-1618314650'], ['1.0.13-1589279873', 'e597811'], ['73a3788']]