mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
[PTRun][Calculator]Allow scientific notation with lowercase 'e' (#36187)
This commit is contained in:
@@ -20,7 +20,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
|
|||||||
@"sinh\s*\(|cosh\s*\(|tanh\s*\(|arsinh\s*\(|arcosh\s*\(|artanh\s*\(|" +
|
@"sinh\s*\(|cosh\s*\(|tanh\s*\(|arsinh\s*\(|arcosh\s*\(|artanh\s*\(|" +
|
||||||
@"pi|" +
|
@"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]+|[\+\-\*\/\^\., ""]|[\(\)\|\!\[\]]" +
|
@"e|[0-9]|0x[0-9a-fA-F]+|0b[01]+|[\+\-\*\/\^\., ""]|[\(\)\|\!\[\]]" +
|
||||||
@")+$",
|
@")+$",
|
||||||
RegexOptions.Compiled);
|
RegexOptions.Compiled);
|
||||||
@@ -73,11 +73,11 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
|
|||||||
* (-?(\d+({0}\d*)?)|-?({0}\d+)): Used to capture one of two types:
|
* (-?(\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")
|
* -?(\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")
|
* -?({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")
|
* (-?\d+): Captures an integer number (e.g. "-1" or "23")
|
||||||
*/
|
*/
|
||||||
var p = @"(-?(\d+(\.\d*)?)|-?(\.\d+))E(-?\d+)";
|
var p = @"(-?(\d+(\.\d*)?)|-?(\.\d+))e(-?\d+)";
|
||||||
return Regex.Replace(input, p, "($1 * 10^($5))");
|
return Regex.Replace(input, p, "($1 * 10^($5))", RegexOptions.IgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user