Got more questions? Find advice on: ASP | SQL | XML | Windows
Welcome to RegexAdvice Sign in | Join | Help

Re: Length of an Email

  •  05-08-2007, 3:15 PM

    Re: Length of an Email

    docdawson:

     ^(\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*){n,20}$

    Doesn't this just match n to 20 e-mail addresses? I understand carlosaml wants addresses with no more than 20 characters.

    The shortest possible address that will match the pattern above has 5 characters (a@b.c).

    To check for 5 to 20 characters one would have to use a lookahead assertion:

    ^(?=.{5,20}$)\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$
    Filed under: , ,
View Complete Thread