Contact: aviboots(AT)netvision.net.il
39,937 questions
51,874 answers
573 users
import re text = "The price is 148.95 dollars" float_regex = r"[-+]?\d*\.\d+|\d+" match = re.search(float_regex, text) if match: number = float(match.group()) print("Extracted float:", number) ''' run: Extracted float: 148.95 '''