fork download
  1. import re
  2. text = "one,two or three , four or five or , or six , oR , seven, ,,or, ,, eight or qwertyor orqwerty,"
  3. print( re.split(r'(?:\s*(?:,|\bor\b))+\s*', text.rstrip().rstrip(',')) )
Success #stdin #stdout 0.03s 9648KB
stdin
Standard input is empty
stdout
['one', 'two', 'three', 'four', 'five', 'six', 'oR', 'seven', 'eight', 'qwertyor orqwerty']