4,2 float? Then
if (ereg("[.[:digit]]([[:digit:]]{4}.[[:digit:]]{2}).$", "\1", $in, $reOut))
Btw, my previous post had a little bug:
if (ereg("[.[:digit]]([[:digit:]](.[[:digit:]])?).$", "\1", $in, $reOut))
"?" was missing (in case number was integer and not double).
You can also add:
else
$out = (double)$in; (or report error - else is when there is no 4,2 float in input string)