import re str = "(f-dqcn-bus:1),(f-cdqc-bus:2)"businesses = re.findall(r"(?<=-)[^-)]+(?=\))", str)print(businesses)
Standard input is empty
['bus:1', 'bus:2']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!