regex string without spaces code example
Example 1: regex only letters not spaces
var re = /^[A-Za-z]+$/;
Example 2: regex to remove spaces
//..
return str.replace(/\s/g, '');
//..
Example 3: regex ignore spaces
\s* ignore spaces
eg \s*yourregex\s*