0

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

Ahmad
  • 214
  • 1
  • 13

2 Answers2

0

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=

Ahmad
  • 214
  • 1
  • 13
-1

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/