Contact: aviboots(AT)netvision.net.il
39,988 questions
51,933 answers
573 users
$text = "The price is 148.95 dollars"; $floatRegex = '/[-+]?\d*\.\d+|\d+/'; if (preg_match($floatRegex, $text, $matches)) { $number = floatval($matches[0]); echo "Extracted float: " . $number; } /* run: Extracted float: 148.95 */