javascript regex : only english letters allowed

let res = /^[a-zA-Z]+$/.test('sfjd');
console.log(res);

Note: If you have any punctuation marks or anything, those are all invalid too. Dashes and underscores are invalid. \w covers a-zA-Z and some other word characters. It all depends on what you need specifically.

Leave a Comment