I need to extract both positive and negative integers from a binomial expression in String form. Then those numbers will be assigned to an array.
This string:
"(-22x+43)^2"
would become this array:
[-22, 43, 2]
Or,
This string:
"(x-22)^-2"
would become this array:
[1, -22, -2]
I'm familiar with arrays, but have no idea how to extract numbers. I've looked into regular expressions and that process seems mysterious. Can this be done without regular expressions? What is the best way to think about solving this type of problem?