Javascript Replace all new line characters in a string with br tag July 24, 2018 Sudeep function convertNewLineToBr(text) { return text.replace(/\n/g, '<br>'); }