I’m passing a string with jQuery, but it throws an Invalid or unexpected token error anytime there’s a CR+LF without a leading white space in front of it.
I’m trying to use the js function replaceAll() to fix these instances before passing the string, but I can’t seem to find the right syntax.
When I use replaceAll(new RegExp(/S+[rn]/g), ” rn”);, it replaces the S string, when I just want to replace the rn with a space + rn AFTER the S.
For example, I want:
This is the end
of the line
To become (underscore symbolizes a space character):
This is the end_
of the line
It’s important that if a line already ends with a space + CRLF, that we don’t add an additional space character.