Javascript String trimBoth(s)
String.prototype.trimBoth = function(s) { return this.replace(new RegExp("^" + s + "+|" + s + "+$", "gm"), ""); }