From d7641fbb2f61d74ef0e877a968a0205cfc52841b Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Fri, 10 Jul 2026 08:16:58 +0200 Subject: [PATCH] use regex for isnum --- src/core/shuntingYard.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/shuntingYard.cpp b/src/core/shuntingYard.cpp index fd51bbf5e..8d7755a72 100644 --- a/src/core/shuntingYard.cpp +++ b/src/core/shuntingYard.cpp @@ -21,6 +21,7 @@ #include "emsesp.h" #include "shuntingYard.h" +#include namespace emsesp { @@ -333,6 +334,9 @@ std::deque shuntingYard(const std::deque & tokens) { // check if string is a number bool isnum(const std::string & s) { + std::regex r("^[+-]?(\\d+\\.?\\d*)$"); + return std::regex_match(s, r); + /* if (s.empty() || s.find_first_of("0123456789") == std::string::npos) { return false; } @@ -340,6 +344,7 @@ bool isnum(const std::string & s) { return true; } return false; + */ }