I have a string containing both "CRLF" and "LF" as line separator.
I want to replace only "CRLF" with " LF" (space and LF) and keeping "LF" as it is.
I know,we can do this using regex, but I have tried few regex from the already existing answers, but not able to resolve.
Please help, I am new to the javascript/jQuery.
As simple as
the_string.replace(/\r\n/g, "\n");
where \r is the escape sequence for CR and \n is the one for LF and g is a regex modifier to replace all matching instances instead of only the first one found.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With