javascript regex match how to remove white space code example Example: remove whitespace with regex javascript return str.replace(/\s/g, '');