regex match only alphabets code example
Example 1: how to check if a string has only alphabets in javascript
if (!/[^a-zA-Z]/.test(word))
Example 2: regex notation for alphabet characters
/^[A-Z]+$/i
/^[A-Za-z]+$/
if (!/[^a-zA-Z]/.test(word))
/^[A-Z]+$/i
/^[A-Za-z]+$/