I'm trying build a regex that will replace any characters not of the format:
any number of digits, then optional (single decimal point, any number of digits)
i.e.
123            // 123
123.123        // 123.123
123.123.123a   // 123.123123
123a.123       // 123.123
I am using ereg_replace in php and the closest to a working regex i have managed is
ereg_replace("[^.0-9]+", "", $data);
which is almost what i need (apart from it will allow any number of decimal points)
i.e.
123.123.123a    // 123.123.123
my next attempt was
ereg_replace("[^0-9]+([^.]?[^0-9]+)?", "", $data);
which was meant to translate as
[^0-9]+        // any number of digits, followed by
(              // start of optional segment
  [^.]?        // decimal point (0 or 1 times) followed by
  [^0-9]+      // any number of digits
)              // end of optional segment
?              // optional segment to occur 0 or 1 times
but this just seems to allow any number of digits and nothing else.
Please help
Thanks