Last active
August 29, 2015 14:02
-
-
Save tsbits/8ccd0927b0afbf2e04a2 to your computer and use it in GitHub Desktop.
Check if a string contains only letters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkAlpha(word) { | |
var newStr = word.replace(/(^\s+|\s+$)/g,''); | |
if (newStr.length > 0) { | |
if (/[^A-Za-zàáâãäåæçèéêëæìíîïñòóôõöøßùúûüÿÀÁÂÃÄÅÆÇÈÉÊËÆÌÍÎÏÑÒÓÔÕÖØßÙÚÛÜŸ \-']/.test(newStr)) return false; | |
else return true; | |
} else return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment