var newString = someString.replace(/\n/, '#');
Works great, when i do an alert;
alert(newString);
It appears as this:
"Firstline
#Secondline
#ThirdLine"
I wish for it to display:
"Firstline#SecondLine#Thirdline"
This is screwing up my other coding!
Can anyone help?
Some OS have
\r\nfor newlines. So, add an optional carriage return character to the RegExp. Also, add a global flag to your RegExp if you want to replace all occurrences: