Regular Expression To Match Only Alphabets And Spaces

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:

See Also:

Regex Is Copied!