You could avoid using perg_replace with say:
$str = '$123,qwe234,sdf454.wer45';
$len = strlen($str);
$temp = '';
for ($i = 0; $i < $len; $i++) {
if (ctype_digit($str{$i}) || $str{$i} == '.')
$temp .= $str{$i};
}
$str = $temp;
Or if you insist:
$str = preg_replace('/[^0-9\.]/', '', $str);
Though regular expressions are often slower then customised solutions.
Of course, if you define what you want more clearly (e.g. a numeric string with the decimal point in a syntatically correct position), then regular expressions become the obvious choice.