$re = '/^-?(0|[1-9]\d*)(?<!-0)$/m';
$str = '3
999
-3
0
0.0
1.90
0.1
.01
-0.0000000000000000000000000000000001
2e3
-2e3
2e-3
-2e-3
1.0e0
0.1e1
.01e-1
-9.1e3
-9.1e-3
9E5
0e-11
0xff
0XFF
0x0
0xfe3
-0
-0.0
-0.0000000000000000000000000000000000
-.0
-.0000000000000000000000000000000000
1xff
0x
0x0fg3
0xf4.
.0xf
0xfe-3
-0xff
0.0xff
0xff.1
e89
.e3
001
-00.2
3.
a
-1
--1
-.1
2..3
2-
2...3
2.4.3
5-6-7
.-1';
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