import rep = re.compile(r'(?=(~[^\s~]+~))')test_str = " ~*_abc~xyz~ ~123~"print(p.findall(test_str))
Standard input is empty
['~*_abc~', '~xyz~', '~123~']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!