Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #express #characters #keyboard #js #reg #exp
ADD COMMENT
Topic
Name
9+1 =