fix incorrect detection of leading '-' on floating point numbers

This commit is contained in:
Axel Kohlmeyer
2022-12-17 22:31:02 -05:00
parent 5a18cea6c9
commit 9137edae10
2 changed files with 67 additions and 7 deletions

View File

@ -1163,9 +1163,9 @@ bool utils::is_double(const std::string &str)
{
if (str.empty()) return false;
if (strmatch(str, "^[-+]?\\d+\\.?\\d*$") || strmatch(str, "^[-+]?\\d*\\.\\d+$") ||
strmatch(str, "^[-+]?\\d+\\.?\\d*[eE][-+]?\\d+$") ||
strmatch(str, "^[-+]?\\d*\\.\\d+[eE][-+]?\\d+$"))
if (strmatch(str, "^[+-]?\\d+\\.?\\d*$") || strmatch(str, "^[+-]?\\d*\\.?\\d+$") ||
strmatch(str, "^[+-]?\\d+\\.?\\d*[eE][+-]?\\d+$") ||
strmatch(str, "^[+-]?\\d*\\.?\\d+[eE][+-]?\\d+$"))
return true;
else
return false;