fork download
  1. import re
  2.  
  3. regex = r"(?::[:;]|[^;\n])+"
  4. str = "foo;bar:;baz::;one:two;::three::::;four;;five:::;six;:seven;::eight"
  5. print(re.findall(regex, str))
Success #stdin #stdout 0.02s 9620KB
stdin
Standard input is empty
stdout
['foo', 'bar:;baz::', 'one:two', '::three::::', 'four', 'five:::;six', ':seven', '::eight']