I just worked on some validation and was fixated on that, though :( I want a text containing only [az] [AZ] [0-9] [_].
It must accept any of these characters any number of times in any order. All other characters are marked as invalid.
I tried this, but it does not work!
{
......
Regex strPattern = new Regex("[0-9]*[A-Z]*[a-z]*[_]*");
if (!strPattern.IsMatch(val))
{
return false;
}
return true
}
source
share