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