How you’d find a line break varies between operating system encodings. Windows would be \r\n
, but Linux just uses \n
and Apple uses \r
.
I found this in JavaScript line breaks:
someText = someText.replace(/(\r\n|\n|\r)/gm, "");
That should remove all kinds of line breaks.
More Related Contents:
- Regular expression to get a string between two strings in Javascript
- How to count string occurrence in string?
- Replace multiple strings with multiple other strings
- How can I extract a number from a string in JavaScript?
- Regular Expression to get a string between parentheses in Javascript
- Fastest method to escape HTML tags as HTML entities?
- Split large string in n-size chunks in JavaScript
- Check for special characters in string
- Get Substring between two characters using javascript
- Use dynamic (variable) string as regex pattern in JavaScript
- Regular expression which matches a pattern, or is an empty string
- Javascript – return string between square brackets
- Remove whitespace and line breaks between HTML elements using jQuery
- Convert camelCaseText to Title Case Text
- javascript regular expression to check for IP addresses
- Passing regex modifier options to RegExp object
- Wrap tags around http text
- How to extract a string using JavaScript Regex?
- match() returns array with two matches when I expect one match
- Split string on the first white space occurrence
- Javascript unicode string, chinese character but no punctuation
- How do I split a string by whitespace and ignoring leading and trailing whitespace into an array of words using a regular expression?
- Insert space before capital letters
- Replacing accented characters with plain ascii ones [duplicate]
- Best way to parse HTML in Javascript
- Use RegExp to match a parenthetical number then increment it
- JavaScript: indexOf vs. Match when Searching Strings?
- Get filename from string path in javascript?
- Removing backslashes from strings in javascript
- Find and replace nth occurrence of [bracketed] expression in string