Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
i want example like this
 
ppp@gmail.com
ppp.ddd@gmail.com
ppp23@gmail.com
 
this type of email only it can accept
Posted 4-Apr-12 19:22pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hey,
U can Use Regular Expression Validator for this.
it will help u
best luck
  Permalink  
Comments
prabakaransat at 5-Apr-12 0:58am
   
ok.
 
regards,
praba.
Marcus Kramer at 11-Apr-12 9:35am
   
Please use full words here. We really don't like Textspeak at CP.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hello,
 
You can use Regular expression: \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b
 
or you can use the in-build validations of C#.Net, you can find it under:
Toolbox -> Validation -> RegularExpressionValidator
 

-AJV King
(Vinco Source)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Try this:
 void EmailValidation(object sender, CancelEventArgs e)
        {
            System.Text.RegularExpressions.Regex rEMail = new System.Text.RegularExpressions.Regex(@"^[a-zA-Z][\w\.-]{0,68}[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$");
            if (txtEmail.Text.Length > 0)
            {
                if (!rEMail.IsMatch(txtEmail.Text))
                {
                    MessageBox.Show("Invalid e-mail id.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtEmail.SelectAll();
                    e.Cancel = true;
                }
            }             
        }
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Hello,
 

Check this out.
 

Email ID Validation[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

public static bool isEmail(string inputEmail)
{
   inputEmail  = NulltoString(inputEmail);
   string strRegex = @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
         @"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" + 
         @".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
   Regex re = new Regex(strRegex);
   if (re.IsMatch(inputEmail))
    return (true);
   else
    return (false);
}
 
You can also see
Email Validation
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 8

Do you have any knowledge about regular expression?
You can follow this page for details in regular expression.
You can validate any thing using regular expression.
 
http://www.regular-expressions.info/[^]
 
Go through this site and if have any problem using this and you can ask me freely.
 
You can use this direct link to example
 
http://www.regular-expressions.info/tutorial.html[^]
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Mathew Soji 334
1 Maciej Los 295
2 BillWoodruff 290
3 Afzaal Ahmad Zeeshan 257
4 DamithSL 225
0 OriginalGriff 6,369
1 Sergey Alexandrovich Kryukov 5,973
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 4,045


Advertise | Privacy | Mobile
Web03 | 2.8.1411019.1 | Last Updated 20 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100