I have the following string in javascript
var q = "M (95+(4*5)) L (95-(4*5))"
I need it to look like
"M 115 L 75"
Please note that var q could be a very long pattern with multiple M and L. Would anybody know how to accomplish this. Any help will be greatly appreciated.