I have strings which are just basic math equations. How can I split each number into an array and leave the operator as its own item in the array?
"123/12*312+4-2"
The output I would like to have is the following:
["123", "/", "12", "*", "312", "+", "4", "-", "2"]
I am using this:
str.split(/[^\d]/)
All other ways of doing this keep the separator but it is part of the number instead of its own array value.