Replace String.trimRight() with regex in order to support IE10+

For work I've been doing on brackets-in-browser (see https://blog.webmaker.org/webmaker-experiments-with-brackets) I had to fix this use of `trimRight` so it would work in IE10+.  With this change, I'm able to run things in IE10+:

![screen shot 2014-03-18 at 9 50 30 am](https://f.cloud.github.com/assets/427398/2448574/13c299ea-aea8-11e3-8700-2cd1f8e4efbb.png)