$re = '/[^0-9.\n-]+|^-0*(?:1\.0*[1-9]|[2-9]|1\d+).*|(?!^)-/m';
$str = '0
-1
.00000
-1.0000
-1.0
-1.0001
-2
-1.9
-400
1lllllllll
12
12.
1234.124
123.-234.234
-00001.0000
-00001.001
-00002';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php