Node.js examples for Regular expression:Match
Replace a new line character by regex
String.prototype.replaceNewLineChars = function( replacement ) { return this.replace( /\n/g, replacement ) ; }