fork download
  1. import re
  2.  
  3. s = """sjdjd|shjdjd,A|shdahdajh,E|hsdhsdj,C|asnma,A
  4. shabnmun|sjddamd,E|wqhsbn,E,teyiuiw,S|ssbxnsmcn,A|vscnbdcmdn,E
  5. sanbsnk|scbdcbd,A"""
  6.  
  7. l1 = re.findall(r'^[^|]+', s, flags=re.MULTILINE)
  8. lA = re.findall(r'(?<=[|,])[^|,]+(?=,A)', s)
  9. lE = re.findall(r'(?<=[|,])[^|,]+(?=,E)', s)
  10. lC = re.findall(r'(?<=[|,])[^|,]+(?=,C)', s)
  11. lS = re.findall(r'(?<=[|,])[^|,]+(?=,S)', s)
  12.  
  13. groups = [l1, lA, lE, lC, lS]
  14. for group in groups:
  15. print(group)
  16.  
Success #stdin #stdout 0.02s 9528KB
stdin
Standard input is empty
stdout
['sjdjd', 'shabnmun', 'sanbsnk']
['shjdjd', 'asnma', 'ssbxnsmcn', 'scbdcbd']
['shdahdajh', 'sjddamd', 'wqhsbn', 'vscnbdcmdn']
['hsdhsdj']
['teyiuiw']