How to replace line break characters?

L

laredotornado

Hello,

What am I doing wrong in my regular expression? I'm trying to replace
line break characters by

responseText =
responseText.replace(/(\r|\n)/, "");

However my response still contains characters with ASCII values of 10.
How can I rewrite the above?

Thanks, - Dave
 
G

Georgi Naumov

Did you try something like this:
responseText =responseText.replace(/[\r\n]+/g, "");
This is explained token:
[\r\n]+
Match a single character present in the list below «[\r\n]+»
Between one and unlimited times, as many times as possible, giving
back as needed (greedy) «+»
A carriage return character «\r»
A line feed character «\n»

Best Regards
(e-mail address removed) напиÑа:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top