import re my_string = "The price of the product is $100.50, but with a discount of 20%, it becomes $80.40." numbers = re.findall(r"\d+\.\d+|\d+", my_string) print(numbers)