fork download
  1. import re
  2. s = '!Example,Value,1,*SPLIT_THIS=True,*AND_THIS=True,*CONDITION=Something/ELSE:!Example,Value,2,*DONT_SPLIT=True,*AND_NOT_THIS=True,*CONDITION=SomethingElse/ELSE:False'
  3. x = re.search(r"\*(CONDITION|MOREOPTIONS)", s)
  4. res = []
  5. if x:
  6. res = re.findall(r"(?:^|\*)[^*]+(?=,|$)", s[:x.start(1)])
  7. res.append(s[x.start(1):])
  8.  
  9. print(res)
Success #stdin #stdout 0s 23304KB
stdin
Standard input is empty
stdout
['!Example,Value,1', '*SPLIT_THIS=True', '*AND_THIS=True', 'CONDITION=Something/ELSE:!Example,Value,2,*DONT_SPLIT=True,*AND_NOT_THIS=True,*CONDITION=SomethingElse/ELSE:False']