Skip to content
Advertisement

Regex for allowing alphanumeric,-,_ and space

I am searching for a regular expression for allowing alphanumeric characters, -, _ or spaces in JavaScript/jQuery.

How can this be done?

Advertisement

Answer

Try this regex:

/^[a-zd-_s]+$/i
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement