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