The below code is used to validate the Email Id.
public boolean validateField(FieldId _fieldIdToCheck)
{
boolean ret;
Str emailPattern = @"\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b";
System.Text.RegularExpressions.Match myMatch;
ret = super(_fieldIdToCheck);
if (_fieldIdToCheck == fieldNum(PracticeDemo, EmailID))
{
myMatch = System.Text.RegularExpressions.Regex::Match(this.EmailID, emailPattern);
if (!myMatch.get_Success())
{
ret = checkFailed(strFmt("%1 is not an valid email id ", this.EmailID));
}
}
return ret;
}
No comments:
Post a Comment