Files
30-seconds-of-code/snippets/isAlpha.md
Angelos Chalaris 8a6b73bd0c Update covers
2023-02-16 22:24:28 +02:00

478 B

title, tags, cover, firstSeen, lastUpdated
title tags cover firstSeen lastUpdated
String is alpha string,regexp coffee-phone-tray-3 2020-12-31T14:01:42+02:00 2020-12-31T14:01:42+02:00

Checks if a string contains only alpha characters.

  • Use RegExp.prototype.test() to check if the given string matches against the alphabetic regexp pattern.
const isAlpha = str => /^[a-zA-Z]*$/.test(str);
isAlpha('sampleInput'); // true
isAlpha('this Will fail'); // false
isAlpha('123'); // false