       keystroke += '-' if keystroke
       keystroke += 'shift'
     # Only upper case alphabetic characters like 'a'
-    key = key.toUpperCase() if /^[a-z]$/.test(key)
+    key = key.toUpperCase() if LowerCaseLetterRegex.test(key)
   else
-    key = key.toLowerCase() if /^[A-Z]$/.test(key)
+    key = key.toLowerCase() if UpperCaseLetterRegex.test(key)
   if event.metaKey
     keystroke += '-' if keystroke
     keystroke += 'cmd'

  cancelable = true
  view = null

  key = key.toUpperCase() if /^[a-z]$/.test(key)
  if key.length is 1
    keyIdentifier = "U+#{key.charCodeAt(0).toString(16)}"
  else


AtomModifierRegex = /(ctrl|alt|shift|cmd)$/
WhitespaceRegex = /\s+/
LowerCaseLetterRegex = /^[a-z]$/
UpperCaseLetterRegex = /^[A-Z]$/

KeyboardEventModifiers = new Set
KeyboardEventModifiers.add(modifier) for modifier in ['Control', 'Alt', 'Shift', 'Meta']
