import re regex = r"[+ →]+" test_str = "N2 + CH4 → HCN + NH3" print(re.split(regex, test_str))
Standard input is empty
['N2', 'CH4', 'HCN', 'NH3']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!