I am trying to create a regex that will allow people to search with "*" as a wildcard, which from my understanding is pretty standard. I have the following for a current regex:
@"($([a-zA-Z0-9!\@#\$%\^&\(\)-_\+\.'`~/=\?\{\}\|]){6,255}|([\w]){0,0})"
When I run the code, and I try to do the search with the wildcard, it tells me "at least one character is required" which leads me to believe that it's only reading the wildcard part and not the first part that has all the characters in it. What am I doing wrong in this regex?
By the way, this is for an ASP.NET MVC 3 project in C#.
Edit::: This regex is part of the ViewModel in an MVC 3 project, the regex is part of the data annotations on a property in the viewmodel. I'm not looking to put code anywhere else but in the data annotation, which is why it's a single line of code. This is the full annotation for the code above:
[RegularExpression(@"($([a-zA-Z0-9!\@#\$%\^&\(\)-_\+\.'`~/=\?\{\}\|]){6,255}|([\w]){0,0})", ErrorMessageResourceType = typeof(AdminResource), ErrorMessageResourceName = "SearchWildcardError")]