Trim string from both side using regex - Node.js String

Node.js examples for String:Trim

Description

Trim string from both side using regex

Demo Code


String.prototype.trim=function(){
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

Related Tutorials