0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-26 13:52:38 +00:00

Add exponents via '^'

This commit is contained in:
Trevor Buckner
2024-02-12 11:58:56 -05:00
parent 74ddc71962
commit c035404555

View File

@@ -336,7 +336,7 @@ const replaceVar = function(input, hoist=false) {
// Split the string into separate expressions
//const variableRegex = /[a-zA-Z_][a-zA-Z0-9_]*(?=\s*(?:[+\-*\/)]|$))/g;
let mathRegex = /[a-z]+\(|[+\-*/()]/g;
let mathRegex = /[a-z]+\(|[+\-*/^()]/g;
let matches = label.split(mathRegex)
let mathVars = matches.filter(match => isNaN(match))?.map((s)=>s.trim()); // Capture any variable names