static bool IsNumeric(string sExpression)
{
Regex objRegx = new Regex(@"[^0-9-\.]");
return !objRegx.IsMatch(sExpression);
}
public bool OnlyAlphabets(string objValue, int minLen, int maxLen)
{
Regex re = new Regex("^[a-z,A-Z\\s]{" + minLen + "," + maxLen + "}$");
if (!re.IsMatch(objValue))
{
return false;
}
else
{
return true;
}
}
public bool OnlyNumbers(string objValue, int minLen, int maxLen)
{
Regex re = new Regex("^[0-9]{" + minLen + "," + maxLen + "}$");
if (!re.IsMatch(objValue))
{
return false;
}
else
{
if ((objValue.Length < minLen) || (objValue.Length > maxLen))
{
return false;
}
else
{
return true;
}
}
}
public bool ValidateEmail(string objValue)
{
Regex re = new Regex("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
if (!re.IsMatch(objValue))
{
return false;
}
else
{
return true;
}
}
{
Regex objRegx = new Regex(@"[^0-9-\.]");
return !objRegx.IsMatch(sExpression);
}
public bool OnlyAlphabets(string objValue, int minLen, int maxLen)
{
Regex re = new Regex("^[a-z,A-Z\\s]{" + minLen + "," + maxLen + "}$");
if (!re.IsMatch(objValue))
{
return false;
}
else
{
return true;
}
}
public bool OnlyNumbers(string objValue, int minLen, int maxLen)
{
Regex re = new Regex("^[0-9]{" + minLen + "," + maxLen + "}$");
if (!re.IsMatch(objValue))
{
return false;
}
else
{
if ((objValue.Length < minLen) || (objValue.Length > maxLen))
{
return false;
}
else
{
return true;
}
}
}
public bool ValidateEmail(string objValue)
{
Regex re = new Regex("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
if (!re.IsMatch(objValue))
{
return false;
}
else
{
return true;
}
}
public bool ValidateMobile(string objValue,int minLen, int maxLen)
{
Regex re = new Regex("^[0-9]{10}");
if (!re.IsMatch(objValue))
{
return false;
}
else
{
return true;
}
}
No comments:
Post a Comment