Mail id validation

deepakbn9099

New Member
Hi all,

How to validate mail id based on below conditions :
1. Mail id should not have two times @
2. Mail id should have one .
3. Mail id should have only 3 characters after .
 

Stephanie

New Member
You can validate the requirements through a decision-making stage. Here's a solution for the first two conditions:

1. Only one @:
InStr(Right([Mail ID]; Len([Mail ID])-InStr([Mail ID]; "@")); "@")=0

2. A dot after the @:
InStr(Right([Mail ID]; Len([Mail ID])-InStr([Mail ID]; "@")); ".")>0
 

SaJ

New Member
Use this code:

Regex regex = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
Match match = regex.Match(txtemail); // input mail address
result=match.Success;
 
Top