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.
More Related Contents:
- I need a Javascript REGEX for Integers between 18 and 140 inclusive [closed]
- Regular expression for a valid temperature value (Celsius)
- jQuery selector regular expressions
- RegEx to extract all matches from string using RegExp.exec
- How to capture an arbitrary number of groups in JavaScript Regexp?
- Alternation operator inside square brackets does not work
- Javascript RegEx Not Working [duplicate]
- Remove all special characters with RegExp
- Regex using javascript to return just numbers
- Convert camelCaseText to Title Case Text
- Regular expression not working for at least one European character
- Matching exact string with JavaScript
- Finding Plus Sign in Regular Expression
- Combining regular expressions in Javascript
- Why does String.match( / \d*/ ) return an empty string?
- RegEx: How can I match all numbers greater than 49?
- How can I replace newlines/line breaks with spaces in javascript?
- How do I split a string by whitespace and ignoring leading and trailing whitespace into an array of words using a regular expression?
- Remove specific HTML tag with its content from javascript string
- Regex only capturing last instance of capture group in match
- Javascript RegExp for splitting text into sentences and keeping the delimiter
- Commenting Regular Expressions
- How can I use regex to get all the characters after a specific character, e.g. comma (“,”)
- Only numbers. Input number in React
- Match all URLs in string and return in array in JavaScript
- Regex.prototype.exec returns null on second iteration of the search [duplicate]
- Part of String Case Insensitive in JavaScript Regex (?i) option not working
- JavaScript: how to use a regular expression to remove blank lines from a string?
- Regular Expression to MATCH ALL words in a query, in any order
- Javascript – how to find hebrew?