Node.js examples for String:Strip
Stripping leading and trailing spaces
String.prototype.trim = function () { return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"); };