The idea is to take a string of letters and numbers much like an algebraic expression with indices and split them up while including the index with the corresponding letter. For example: You take the expresson 2x^3
and it would be split into an array like so ["2","x^3"]
As of right now I have tried to work with the letters and the number can come later but this is what I have got so far:
expression.split(/([a-z])/);
This takes the string and splits it at every number. I'm not good at regular expression so some help on including the index of a letter with the split would be much appreciated.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.