regex ignore whitespace javascript code example
Example 1: remove whitespace with regex javascript
return str.replace(/\s/g, '');
Example 2: regex ignore spaces
\s* ignore spaces
eg \s*yourregex\s*
return str.replace(/\s/g, '');
\s* ignore spaces
eg \s*yourregex\s*