• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • Last Modified:

Regex string validation question

Hi,
I am a newbie with Regex.  Could you please come up with an expresion that could be used to validate that an input string only contains the characters:  a-z, A-Z, space, or "-" (hyphen).

I need to use this to validate the input string from a form.

Thanks in advance,
hefterr
0
hefterr
Asked:
hefterr
1 Solution
 
käµfm³d 👽Commented:
^[a-zA-Z -]+$

Open in new window


If the field can be empty, change the + to a *
0
 
hefterrAuthor Commented:
Thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now