R
rhkodiak
I need help with validating usernames using regular expressions. I
only want to allow numbers, letters, and the underscore as valid
characters for the username. I just cannot seem to find the solution,
but I believe I am close. Any help provided is appreciated! Here is
my code below which I am using to validate usernames.
public bool ValidateHandle(string handle)
{
bool retVal = false;
if(Regex.IsMatch(handle, "^[a-zA-Z0-9_]$"))
{
retVal = true;
}
return retVal;
}
only want to allow numbers, letters, and the underscore as valid
characters for the username. I just cannot seem to find the solution,
but I believe I am close. Any help provided is appreciated! Here is
my code below which I am using to validate usernames.
public bool ValidateHandle(string handle)
{
bool retVal = false;
if(Regex.IsMatch(handle, "^[a-zA-Z0-9_]$"))
{
retVal = true;
}
return retVal;
}