You want \s
Matches a single white space
character, including space, tab, form
feed, line feed.
Equivalent to
[ \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]
in Firefox and [ \f\n\r\t\v]
in IE.
str = str.replace(/\s/g, "X");
More Related Contents:
- How do I chop/slice/trim off last character in string using Javascript?
- Trim string in JavaScript?
- .trim() in JavaScript not working in IE
- Replace multiple whitespaces with single whitespace in JavaScript string
- Trim specific character from a string
- Get URL from background-image Property
- How to trim() white spaces from a string?
- Remove whitespaces inside a string in javascript
- String strip() for JavaScript? [duplicate]
- How do you inject this code into HTML using Javascript?
- Date is in string format
- Transform numbers to words in lakh / crore system
- Check if an element is present in an array [duplicate]
- Why is “this” in an anonymous function undefined when using strict?
- jQuery function to get all unique elements from an array?
- Uncaught TypeError: Cannot use ‘in’ operator to search for ‘length’ in
- Resetting a setTimeout
- using lodash .groupBy. how to add your own keys for grouped output?
- JavaScript: Know when an image is fully loaded
- How to convert a String to long in javascript?
- Float sum with javascript [duplicate]
- Javascript to convert Markdown/Textile to HTML (and, ideally, back to Markdown/Textile)
- Embedding Google Apps Script in an iFrame
- “Permission denied” with Internet Explorer and jQuery
- Can you create functions with custom prototypes in JavaScript?
- How to append a childnode to a specific position
- TypeError dispatcher.useState is not a function when using React Hooks
- What is the meaning of (0, someFunction)() in javascript [duplicate]
- How to convert a string to ObjectId in nodejs mongodb native driver?
- How do I return data from a $http.get() inside a factory in angularjs