php preg_match filter only numbers and dot code example Example: php filter only numbers $output = preg_replace( '/[^0-9]/', '', $string );