Answers for "how to express all characters in keyboard in js reg exp"

0

how to express all characters in keyboard in js reg exp

// all keys (including space and tab)
var allKeyboardKeysRegex = /^[a-zA-Z0-9~`!@#\$%\^&\*\(\)_\-\+={\[\}\]\|\\:;"'<,>\.\?\/  ]*$/;

// example tests
var nonShiftChars = "`1234567890-=  qwertyuiop[]\asdfghjkl;'zxcvbnm,./ "
var shiftChars = "~!@#$%^&*()_+{}|:\"<>? ";
var someAlphaNumeric = "aAbB12 89yYzZ";

// test with allKeyboardKeysRegex
allKeyboardKeysRegex.test(nonShiftChars);
allKeyboardKeysRegex.test(shiftChars);
allKeyboardKeysRegex.test(someAlphaNumeric);
Posted by: Guest on March-02-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language