import re text = "$h;BREWERY$h_end;You've built yourself a brewery."x = re.findall(r"\$\w+;", text)print(x)
Standard input is empty
['$h;', '$h_end;']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!