Re: Verifying email address format

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Douglas J. Steele (NOSPAM_djsteele_at_NOSPAM_canada.com)
Date: 11/06/04


Date: Sat, 6 Nov 2004 05:51:11 -0500


"John Vinson" <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in message
news:ii8oo054t75bbj343mvhiv06fldg38grnc@4ax.com...
> On Fri, 5 Nov 2004 17:33:17 -0500, "Douglas J. Steele"
> <NOSPAM_djsteele@NOSPAM_canada.com> wrote:
>
> >Depends on your definition of "lied".
> >
> >If you were to use Regular Expressions, it's quite easy. The difficult
part
> >is to come up with the appropriate pattern to match for. One possible
> >pattern is "^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$" That particular pattern
allows
> >any number of letters (no numbers) before the @ character, followed by up
to
> >three levels to the right of the @ character.
>
> Good suggestion - but not flawless.
>
> One of my (no longer active) email addresses was
> 74222.2372@compuserve.com; another I use resembles
>
> Love2Contradance@some.domain
>
> Even with regular expressions this is tough, since email addresses are
> VERY irregular!

I knew full-well that the Regular Expression pattern I suggested was flawed,
but it was the first one I found. There's a site devoted to sharing RexEx
patterns, but I couldn't remember its URL. It's http://www.regexlib.com

Actually, I don't think it should be that tough to get a working RegEx
pattern. I think the rules are fairly strictly as to what characters are
valid. While it's true that email addresses are irregular, you don't really
care what's before the @, as long as it's valid characters (some special
characters such as _ are valid, but I don't have the complete list). I'm
assuming that there's an appropriate standard out there somewhere for what's
a valid email address, in which case it's likely defined in terms of a
pattern. Doing a search on email at RegExLib.com turned up several good
candidates.

BTW, what's contradancing?

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


Relevant Pages

  • [SUMMARY] Statistician I (#167)
    ... The heart of this problem, as suggested in the quiz description, is pattern ... have the pattern matching in place, the rest of the code is pretty trivial. ... use regular expressions, or at least review their knowledge. ... Next, as indicated in the comment, square brackets surrounding text are ...
    (comp.lang.ruby)
  • Re: Verifying email address format
    ... > I knew full-well that the Regular Expression pattern I suggested was ... I don't think it should be that tough to get a working RegEx ... While it's true that email addresses are irregular, ... > characters such as _ are valid, but I don't have the complete list). ...
    (microsoft.public.access.formscoding)
  • Re: position absolute different in IE than firefox, help!
    ... You referring to the F & R dialog box in BBEdit for Mac? ... Grep is the name of a frequently used Unix command that searches ... does is print out each line of the buffer that matches the pattern. ... The thing they have in common is regular expressions, ...
    (alt.html)
  • Re: [OT] Re: Chris Sonnack on VB.Nets putative Set statement
    ... > regex is in a C-ish language string. ... the ease of making errors in regular expressions is a concern ... You do need to replicate the pattern on either side of the comma ...
    (comp.programming)
  • Re: what is the quickest way to find out whether a string contains another string?
    ... Why would anyone want to use regular expressions to look for a plain ... Regular expressions are a tool for deciding whether a String or ... searching is a trivial degeneration of the problem addressed by regular ... input string into a pattern that matches only itself is the first task. ...
    (comp.lang.java.programmer)