diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/CalculateHelper.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/CalculateHelper.cs index f63be439e8de..ea1862bbf0c3 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/CalculateHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/CalculateHelper.cs @@ -20,7 +20,7 @@ public static class CalculateHelper @"sinh\s*\(|cosh\s*\(|tanh\s*\(|arsinh\s*\(|arcosh\s*\(|artanh\s*\(|" + @"pi|" + @"==|~=|&&|\|\||" + - @"((-?(\d+(\.\d*)?)|-?(\.\d+))[E](-?\d+))|" + /* expression from CheckScientificNotation between parenthesis */ + @"((-?(\d+(\.\d*)?)|-?(\.\d+))[Ee](-?\d+))|" + /* expression from CheckScientificNotation between parenthesis */ @"e|[0-9]|0x[0-9a-fA-F]+|0b[01]+|[\+\-\*\/\^\., ""]|[\(\)\|\!\[\]]" + @")+$", RegexOptions.Compiled); @@ -73,11 +73,11 @@ private static string CheckScientificNotation(string input) * (-?(\d+({0}\d*)?)|-?({0}\d+)): Used to capture one of two types: * -?(\d+({0}\d*)?): Captures a decimal number starting with a number (e.g. "-1.23") * -?({0}\d+): Captures a decimal number without leading number (e.g. ".23") - * E: Captures capital 'E' + * e: Captures 'e' or 'E' * (-?\d+): Captures an integer number (e.g. "-1" or "23") */ - var p = @"(-?(\d+(\.\d*)?)|-?(\.\d+))E(-?\d+)"; - return Regex.Replace(input, p, "($1 * 10^($5))"); + var p = @"(-?(\d+(\.\d*)?)|-?(\.\d+))e(-?\d+)"; + return Regex.Replace(input, p, "($1 * 10^($5))", RegexOptions.IgnoreCase); } /*