Float regex: Don't allow double dot; do allow 'e' for exponentials

This commit is contained in:
Christian Bläul
2018-02-18 19:00:24 +01:00
parent 0e5afb209e
commit f702ca93fe

View File

@@ -36,7 +36,7 @@ trait DatatypeTrait {
return 'integer';
}
if (preg_match('/^[+-]?([0-9]*[.])?([0-9]|[.][0-9])+$/', $value)) {
if (preg_match('/(^[+-]?$)|(^[+-]?[0-9]+([,.][0-9])?[0-9]*(e[+-]?[0-9]+)?$)/', $value)) {
return 'float';
}