Quantcast
Channel: How can I validate an email address using a regular expression? - Stack Overflow
Browsing all 89 articles
Browse latest View live

Answer by spig for How can I validate an email address using a regular...

One simple regular expression which would at least not reject any valid email address would be checking for something, followed by an @ sign and then something followed by a period and at least 2...

View Article


Answer by Dimitris Andreou for How can I validate an email address using a...

I don't believe the claim made by bortzmeyer, above, that "The grammar (specified in RFC 5322) is too complicated for that" (to be handled by a regular expression).Here is the grammar: (from...

View Article


Answer by Nazmul Hasan for How can I validate an email address using a...

this is one of the regex for...

View Article

Answer by Greg Bacon for How can I validate an email address using a regular...

For a vivid demonstration, the following monster is pretty good, but it still does not correctly recognize all syntactically valid email addresses: it recognizes nested comments up to four levels...

View Article

Answer by chaos for How can I validate an email address using a regular...

You could use the one employed by the jQuery Validation...

View Article


Answer by Good Person for How can I validate an email address using a regular...

It depends on what you mean by best:If you're talking about catching every valid email address use the following:(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[...

View Article

Answer by Dominic Sayers for How can I validate an email address using a...

[UPDATED] I've collated everything I know about email address validation here: http://isemail.info, which now not only validates but also diagnoses problems with email addresses. I agree with many of...

View Article

Answer by davcar for How can I validate an email address using a regular...

The email addresses I want to validate are going to be used by an ASP.NET web application using the System.Net.Mail namespace to send emails to a list of people.So, rather than using some very complex...

View Article


Answer by cbp for How can I validate an email address using a regular...

We have used http://www.aspnetmx.com/ with a degree of success for a few years now. You can choose the level you want to validate at (e.g. syntax check, check for the domain, mx records or the actual...

View Article


Answer by Joseph Yee for How can I validate an email address using a regular...

Strange that you "cannot" allow 4 characters TLDs. You are banning people from .info and .name, and the length limitation stop .travel and .museum, but yes, they are less common than 2 characters TLDs...

View Article

Answer by JacquesB for How can I validate an email address using a regular...

This question is asked a lot, but I think you should step back and ask yourself why you want to validate email adresses syntactically? What is the benefit really?It will not catch common typos.It does...

View Article

Answer by adnam for How can I validate an email address using a regular...

Cal Henderson (Flickr) wrote an article called Parsing Email Addresses in PHP and shows how to do proper RFC (2)822-compliant email address parsing.You can also get the source code in PHP, Python, and...

View Article

Answer by DOK for How can I validate an email address using a regular...

While deciding which characters are allowed, please remember your apostrophed and hyphenated friends. I have no control over the fact that my company generates my email address using my name from the...

View Article


Answer by PhiLho for How can I validate an email address using a regular...

There is not one which is really usable. I discuss some issues in my answer to Is there a PHP library for email address validation?, it is discussed also in Is regular expression recognition of an...

View Article

Answer by Andy Lester for How can I validate an email address using a regular...

It all depends on how accurate you want to be. For my purposes, where I'm just trying to keep out things like bob @ aol.com (spaces in emails) or steve (no domain at all) or mary@aolcom (no period...

View Article


Image may be NSFW.
Clik here to view.

Answer by bortzmeyer for How can I validate an email address using a regular...

The fully RFC 822 compliant regex is inefficient and obscure because of its length. Fortunately, RFC 822 was superseded twice and the current specification for email addresses is RFC 5322. RFC 5322...

View Article

Answer by Kon for How can I validate an email address using a regular...

I never bother creating with my own regular expression, because chances are that someone else has already come up with a better version. I always use regexlib to find one to my liking.

View Article


Answer by Draemon for How can I validate an email address using a regular...

There are plenty examples of this out on the Internet (and I think even one that fully validates the RFC - but it's tens/hundreds of lines long if memory serves).People tend to get carried away...

View Article

Answer by Chris Vest for How can I validate an email address using a regular...

I don't know about best, but this one is at least correct, as long as the addresses have their comments stripped and replaced with white space.Seriously. You should use an already-written library for...

View Article

Answer by Per Hornshøj-Schierbeck for How can I validate an email address...

I use^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$Which is the one used in ASP.NET by the RegularExpressionValidator.

View Article
Browsing all 89 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>