[PTRun][Calc]Keep leading zeroes on languages where . is not a separator (#28451)

* [PTRun][Calc]Keep leading zeroes on languages where . is not a separator

* Adapt tests
This commit is contained in:
Jaime Bernardo
2023-09-12 11:22:34 +01:00
committed by GitHub
parent 3253df782a
commit 67a2dc0d6f
3 changed files with 43 additions and 7 deletions

View File

@@ -36,8 +36,8 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
}
// check for division by zero
// We check if the string contains a slash followed by space (optional) and zero. Whereas the zero must not followed by dot or comma as this indicates a number with decimal digits.
if (new Regex("\\/\\s*0(?![,\\.])").Match(input).Success)
// We check if the string contains a slash followed by space (optional) and zero. Whereas the zero must not followed by dot or comma as this indicates a number with decimal digits. The zero must also not be followed by other digits.
if (new Regex("\\/\\s*0(?![,\\.0-9])").Match(input).Success)
{
error = Properties.Resources.wox_plugin_calculator_division_by_zero;
return default;