I have a string (mathematical equation):
Wt=mgt
This is what I would like to split them by: ['wt', 'm', 'g', 't']
I would like the result ['Wt', '=', 'm', 'g', t']
I am not sure how to do this.
Clarification:
This should be applicable to all equations inputted. My goal is to have the user input an equation and an array, and split the string into a another array using the initial array they gave me:
split('Wt=mg', ['Wt', 'm', 'g']) // => ['Wt', '=', 'm', 'g']
split('maa=tna', ['ma', 'a', 't', 'n']) // => ['ma', 'a', '=', 't', 'n', 'a']
split('Fnet=ma', ['Fnet', 'm', 'a']) // => ['Fnet', '=', 'm', 'a']