Regular expressions are one of the most powerful tools in a programmer’s arsenal.
If you have ever attempted to create your own regular expression to match only alphabets and spaces, you might find this article useful.
/^[a-zA-Z ]*$/
Matches:
- ABC D
- ABCD
- ABC d
- ABC
Non-matches:
- 123
- [email protected]#$
See Also:
- Regular Expression To Check Non-digit Characters
- Regular Expression To Match Non-Alphanumeric Characters
- Alphanumeric Regular Expression
- Special Characters Regular Expression
Rate This Regex
User Review
( votes)Expression Flags
Flags | Description |
---|---|
i |
Ignore case sensitive. |
g |
Allows global search. |
m |
Allows multiline search. |