Regex to prevent the entering of white space?

72 views Asked by At

I want validate that a username doesn't contain spaces. I want use AZ-az-09 and _ character in my string and ingore another. I have a regex but it is no validating spaces.

[RegularExpression("^([a-zA-Z0-9  .&'-]+)$", ErrorMessage = "Boşluk ve özel karakter girmeyiniz.")]

How can do it?

0

There are 0 answers