A regular expression to match characters that are not letters and spaces in a string. Can be used to remove all characters except letters and spaces from a string.
/[^a-zA-Z ]+/g
Matches:
- ABC123
- 123ABC
- ABC.123
Non-Matches:
- ABC
- AB CD
- ABCD EFG
See Also:
- Regex To Match Anything Except Underscore
- Regex Match All Characters Except Space (Unless In Quotes)
- Regex To Remove Unnecessary Spaces In A String
- Regular Expression For Uppercase Letters