I have the following regular expression:
^[a-zA-Z0-9]+( [a-zA-Z0-9]+)*$
I'm trying to validate a string between 0-10 characters, the string cannot contain more the two spaces in a row or cannot be empty. The string cannot contain any special characters and can be case insensitive and can include hyphens.
How can I limit input to between 0-10 characters?
I tried
^[a-zA-Z0-9]+( [a-zA-Z0-9]+{0,10})*$
but it does not work.
if (str.Length > 10)?.lengthproperty provided by the .NET framework. I'd recommend you use multiple regular expressions to perform smaller, much less complex tasks.