check for alphanumeric regex with space code example Example: how to get only alphanumeric and whitespace in string regex /[A-Za-z\d\s]/g