javascript isalpha – isAlpha. JavaScript, String, Regexp. Use RegExp.prototype.test() to check if the given string matches against the alphabetic regexp pattern.
javascript isalpha – javascript String isalpha() Method
Contents
You could just use a case – insensitive regular expression Checks if the character is an alphabetic character.
- /*/^[a-zA-Z()]*$/ – also returns true for an empty string
- /^[a-zA-Z()]$/ – only returns true for single characters.
- /^[a-zA-Z() ]+$/ – also allows spaces*/
- //better regEX to include question marks too
Example
const isAlpha = str => /^[a-zA-Z]*$/.test(str); isAlpha('pakaInfo'); // true isAlpha('welcom To pakainfo'); // false isAlpha('986565'); // false
Check if a character is alphabetic
`a`.isAlpha(); // true `i`.isAlpha(); // true `3`.isAlpha(); // false
Python String isalpha() Method
txt = "pakainfoCom" x = txt.isalpha() print(x)
Don’t Miss : JavaScript Tutorial
isalphabetic javascript
function isAlphaOrParen(str) { return /^[a-zA-Z()]+$/.test(str); }
I hope you get an idea about javascript isalpha – Isalpha, isalnum in Javascript?.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this Article are always welcome.
If you enjoyed and liked this post, donβt forget to share.
I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I’m a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.