public bool ValidationInServer(ref string errorInfo,string txt, string type)
{
if (type == "0" || type == "1" || type == "3")
{//email address formart validation
if (!Regex.IsMatch(txt, @"^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"))
{
errorInfo = "Please input right email address.";
return false;
}
}
if (type == "2")
{//skype address formart validation
if (Regex.IsMatch(txt, "^[^a-zA-Z](.*)$"))
{
errorInfo = "The Skype Name must be start with letter.";
return false;
}
else
if (Regex.IsMatch(txt, @"\W"))
{
errorInfo = "The Skype Name contains invalid character(s).";
return false;
}
else
if (txt.Length < 6)
{
errorInfo = "The Skype Name must be at least 6 characters long.";
return false;
}
}
return true;
}
{
if (type == "0" || type == "1" || type == "3")
{//email address formart validation
if (!Regex.IsMatch(txt, @"^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"))
{
errorInfo = "Please input right email address.";
return false;
}
}
if (type == "2")
{//skype address formart validation
if (Regex.IsMatch(txt, "^[^a-zA-Z](.*)$"))
{
errorInfo = "The Skype Name must be start with letter.";
return false;
}
else
if (Regex.IsMatch(txt, @"\W"))
{
errorInfo = "The Skype Name contains invalid character(s).";
return false;
}
else
if (txt.Length < 6)
{
errorInfo = "The Skype Name must be at least 6 characters long.";
return false;
}
}
return true;
}
浙公网安备 33010602011771号