Ruby, 24 ---- r=eval s.gsub ?/,'**-1*' Thank you to @ybeltukov for the Mathematica technique. I *thought* there might be a substitution that could be used to leverage `eval` and yours was much simpler than the crazy regexes I was trying!