import res = """$1,289,868$62,000$421"""result = [x.replace(",", "") for x in re.findall(r'\$(\d{1,3}(?:,\d{3})*)', s)]print(result)
Standard input is empty
['1289868', '62000', '421']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!