Node.js examples for String:Replace
Strip all but [a-zA-Z]
'use strict';/*w ww .j a v a 2 s .c o m*/ String.prototype.camelize = function () { return this.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match, index) { if (+match === 0) { return ''; }// or if (/\s+/.test(match)) for white spaces return index === 0 ? match.toLowerCase() : match.toUpperCase(); }); };