$re = '/([\d]*)(.|,)[\d](e|E)[\d]+/m';
$str = 'Valid floating points:
1
+1
-1
65
+65
-65
5.2
5,2
5.225
5,225
985.225
985,225
985.
,225
+5.2
+5,2
+5.225
+5,225
+985.225
+985,225
+985.
+,225
-5.2
-5,2
-5.225
-5,225
-985.225
-985,225
-985.
-,225
5.2E3
5.2e3
+5.2e3
-5.2e3
5,2E3
5,2e3
-5,2e3
+5,2e3
5.2e112
+5.2e112245
-5.2e99999
5,2e112
-5,2e112245
+5,2e99999
5.2e+3
+5.2e+3
-5.2e+3
5,2e-3
-5,2e-3
+5,2e-3
5.e3
5.e+3
+5.e+3
-5.e+3
5,e-3
-5,e-3
+5,e-3
,225e123
+,225e123
-,225e123
.225e123
+.225e123
-.225e123
Not floating points
,
,
,
.
.
.
.e
,e
.e2
,e2
,225e
+,225e
-,225e
.225e
+.225e
-.225e';
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