diff --git a/src/CalcViewModel/Common/CopyPasteManager.cpp b/src/CalcViewModel/Common/CopyPasteManager.cpp index b5a4adfa..5f774b33 100644 --- a/src/CalcViewModel/Common/CopyPasteManager.cpp +++ b/src/CalcViewModel/Common/CopyPasteManager.cpp @@ -23,18 +23,18 @@ static constexpr wstring_view c_validCharacterSet{ L"0123456789()+-*/.abcdefABCD // as both wstring_view and wchar[] can not be concatenated // [\s\x85] means white-space characters static const wstring c_wspc = L"[\\s\\x85]*"; -static const auto c_wspcLParens = c_wspc + L"[(]*" + c_wspc; -static const auto c_wspcLParenSigned = c_wspc + L"([-+]?[(])*" + c_wspc; -static const auto c_wspcRParens = c_wspc + L"[)]*" + c_wspc; -static const auto c_signedDecFloat = L"[-+]?\\d*(\\d|[.])\\d*"; +static const wstring c_wspcLParens = c_wspc + L"[(]*" + c_wspc; +static const wstring c_wspcLParenSigned = c_wspc + L"([-+]?[(])*" + c_wspc; +static const wstring c_wspcRParens = c_wspc + L"[)]*" + c_wspc; +static const wstring c_signedDecFloat = L"[-+]?\\d*(\\d|[.])\\d*"; // Programmer Mode Integer patterns // Support digit separators ` (WinDbg/MASM), ' (C++), and _ (C# and other languages) -static constexpr auto c_hexProgrammerChars = L"([a-f]|[A-F]|\\d)+((_|'|`)([a-f]|[A-F]|\\d)+)*"; -static constexpr auto c_decProgrammerChars = L"\\d+((_|'|`)\\d+)*"; -static constexpr auto c_octProgrammerChars = L"[0-7]+((_|'|`)[0-7]+)*"; -static constexpr auto c_binProgrammerChars = L"[0-1]+((_|'|`)[0-1]+)*"; -static constexpr auto c_uIntSuffixes = L"[uU]?[lL]{0,2}"; +static const wstring c_hexProgrammerChars = L"([a-f]|[A-F]|\\d)+((_|'|`)([a-f]|[A-F]|\\d)+)*"; +static const wstring c_decProgrammerChars = L"\\d+((_|'|`)\\d+)*"; +static const wstring c_octProgrammerChars = L"[0-7]+((_|'|`)[0-7]+)*"; +static const wstring c_binProgrammerChars = L"[0-1]+((_|'|`)[0-1]+)*"; +static const wstring c_uIntSuffixes = L"[uU]?[lL]{0,2}"; // RegEx Patterns used by various modes static const array standardModePatterns = { wregex(c_wspc + c_signedDecFloat + c_wspc) }; @@ -274,7 +274,7 @@ bool CopyPasteManager::ExpressionRegExMatch(vector operands, ViewMode m { // Each operand only needs to match one of the available patterns. bool operandMatched = false; - for (const auto& pattern : patterns) + for (const wregex& pattern : patterns) { operandMatched = operandMatched || regex_match(operand, pattern); } @@ -283,7 +283,7 @@ bool CopyPasteManager::ExpressionRegExMatch(vector operands, ViewMode m { // Remove characters that are valid in the expression but we do not want to include in length calculations // or which will break conversion from string-to-ULL. - const wstring operandValue = SanitizeOperand(operand); + wstring operandValue = SanitizeOperand(operand); // If an operand exceeds the maximum length allowed, break and return. if (OperandLength(operandValue, mode, modeType, programmerNumberBase) > maxOperandLength)