summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FunctionHandler/Math.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/FunctionHandler/Math.php b/src/FunctionHandler/Math.php
index aed1cb92..f8236ca9 100644
--- a/src/FunctionHandler/Math.php
+++ b/src/FunctionHandler/Math.php
@@ -66,7 +66,7 @@ class Math extends Base {
$equation = preg_replace('/\s+/', '', $equation);
// Adapted from https://www.php.net/manual/en/function.eval.php#107377
- $number = '(?:\d+(?:[,.]\d+)?|pi|π)'; // What is a number
+ $number = '-?(?:\d+(?:[,.]\d+)?|pi|π)'; // What is a number
$functionsOrVars = '((?:0x[a-fA-F0-9]+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*))';
$operators = '[,+\/*\^%-]'; // Allowed math operators
$regexp = '/^((' . $number . '|' . $functionsOrVars . '|(' . $functionsOrVars . '\s*\((?1)*\)|\((?1)*\)))(?:' . $operators . '(?1))?)+$/';