I have a string like below:
JytLT1N=
Jy=rtyT1N=
tytTt=
yr=tyrtyr=
all of these lines ends with =CRLF
How can i remove them in javascript ?
UPDATE:
(=) is a fixed char at the end of all lines and after that (CRLF) is a line break char
I have a string like below:
JytLT1N=
Jy=rtyT1N=
tytTt=
yr=tyrtyr=
all of these lines ends with =CRLF
How can i remove them in javascript ?
UPDATE:
(=) is a fixed char at the end of all lines and after that (CRLF) is a line break char
I have found the correct way. The code below woks for me:
var str = "JytLT1N=
Jy=rtyT1N=
tytTt=
yr=tyrtyr=
";
const regex = /=\r?\n|\r/gm;
str.replace(/(\r\n|\n|\r)/gm,"");
Output: JytLT1NJy=rtyT1NtytTtyr=tyrtyr=
You can use
const str = `JytLT1N=
Jy=rtyT1N=
tytTt=
yr=tyrtyr=`;
alert(str.replace(/\n*\r*/g, ""));
My fiddle: https://jsfiddle.net/fwalid/1Lj0fzqh/4/