Merge pull request #3093 from mbrannen/expr-remainder-fix

updated regex sanitization
This commit is contained in:
hydroflame 2022-03-10 21:39:59 -05:00 committed by GitHub
commit 2dfecc8ad0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,7 +17,7 @@ export function expr(
const expr = args.join("");
// Sanitize the math expression
const sanitizedExpr = expr.replace(/s+/g, "").replace(/[^-()\d/*+.]/g, "");
const sanitizedExpr = expr.replace(/s+/g, "").replace(/[^-()\d/*+.%]/g, "");
let result;
try {
result = eval(sanitizedExpr);