import res = "The river *runs slowly* but surely"res = re.findall(r'\*[^*]*\*|(\w+)', s)print(list(filter(None, res)))
Standard input is empty
['The', 'river', 'but', 'surely']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!