A Regular Expression to match two or more consecutive alphabetic characters in a string.
/[a-zA-Z]{2,}/g
Explain:
[]
Character set. Match any character in the set.- a-z Range. Matches a character in the range “a” to “z”. Case sensitive.
- A-Z Range. Matches a character in the range “A” to “Z”. Case sensitive.
{2,}
Quantifier. Match 2 or more of the preceding token.
Matches:
- ab
- abcd
Non-matches:
- a
- a b
- a1
- 123