JS

HOW TO REMOVE LINE BREAKS IN JAVASCRIPT

var str = "Foo\r\nBar"; var nobreak = str   .replace(/\r?\n|\r/g, "");

REGULAR EXPRESSION

01

var str = "Foo\r\nBar"; var nobreak = str   .replaceAll("\r", "")   .replaceAll("\n", "");

STRING REPLACE

02

var str = "Foo<br>Bar"; var nobreak = str   .replaceAll("<br>", "")   .replaceAll("<br/>", "");

REMOVE HTML BREAKS

03

var str = "\r\nFoo Bar\r\n"; var nobreak = str.trim();

TRIM LINE BREAKS

04