Looking for help with extracting numbers and operators from basic math equations. Is there a way to split each number into an array while keeping the operator separate?
"123/12*312+4-2"
The desired output is as follows:
["123", "/", "12", "*", "312", "+", "4", "-", "2"]
I have tried using this code:
str.split(/[^\d]/)
Other methods I've attempted end up keeping the separator attached to the numbers instead of separating them.