I have a text in a textarea and I read it out using the .value attribute.
Now I would like to remove all linebreaks (the character that is produced when you press Enter) from my text now using .replace with a regular expression, but how do I indicate a linebreak in a regex?
If that is not possible, is there another way?
\n. When shown in text, that character is not shown, it just makes a new line, and so to do this with a
replace and some regular expressions, we would do something like this:
... elem.value.replace(/\n/g, " "); // elem is just whatever textarea element you are working with ...
As you may already know
- 1Why is the string immutable in c#
- 1String in C#, string's behavior
- 2How to selects all elements in a document | CSS
- 1How show all installed packages on linux/ubuntu
- 3Converting JS object to JSON string
- 1Remove files from Git commit
- 2Linux/ How can I Find All Files Containing Specific text ?