I need a regular expression for ASP.NET C# to check and make sure that there are at least 2 non alpha-numeric characters and that the whole string is at least 5 characters long. How do I do that? I have been at this for a long time, and this is the closest I can get:
(.*)([\\W].*?[\\W])(.*)
That will make sure that there are at least 2 non alpha-numeric characters in the string, in no particular order just somewhere in the string, which is what it needs to do, but it doesn't guarantee that there will be at least 5 characters.
Something simple like this: .....*?[\\W] guarantees that there will be at least 5 characters but that way you HAVE to put the non alpha-numeric on the end, which is no good. Anybody have any ideas?
Start Free Trial