Click here to Skip to main content
11,493,154 members (64,053 online)
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 Sergey Alexandrovich Kryukov 419
1 Maciej Los 286
2 F-ES Sitecore 224
3 KarstenK 210
4 CPallini 208
0 Sergey Alexandrovich Kryukov 10,132
1 OriginalGriff 8,630
2 Sascha Lefèvre 3,624
3 Maciej Los 3,392
4 Richard Deeming 2,500


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 20 Mar 2013
Copyright © CodeProject, 1999-2015
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