Help validating email addresses

Discussion in 'ASP .Net' started by =?Utf-8?B?U0FM?=, Feb 27, 2006.

  1. I am using a RegularExpressionValidator control on my ASP page, and I have
    the ValidationExpression property set to "Internet E-mail Address". The
    email address is valiated when the user puts in a email addess in the TextBox.

    This works fine until I have multiple email addresses. How can I validate
    multiple e-mail addresses seperated by a "," or ";"? The following
    ValidationExpression will validate up to 2 email addresses but not anymore:

    \w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*([,;]\s*\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*

    Any suggestion would be helpful. The number of emails could be infinite,
    but I think the max will be 10 at most.

    Thanks,
     
    =?Utf-8?B?U0FM?=, Feb 27, 2006
    #1
    1. Advertising

  2. ^(\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*\b([,;]\s?)?)*$
    --
    HTH,
    Phillip Williams
    http://www.societopia.net
    http://www.webswapp.com


    "SAL" wrote:

    > I am using a RegularExpressionValidator control on my ASP page, and I have
    > the ValidationExpression property set to "Internet E-mail Address". The
    > email address is valiated when the user puts in a email addess in the TextBox.
    >
    > This works fine until I have multiple email addresses. How can I validate
    > multiple e-mail addresses seperated by a "," or ";"? The following
    > ValidationExpression will validate up to 2 email addresses but not anymore:
    >
    > \w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*([,;]\s*\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*
    >
    > Any suggestion would be helpful. The number of emails could be infinite,
    > but I think the max will be 10 at most.
    >
    > Thanks,
    >
     
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=, Feb 27, 2006
    #2
    1. Advertising

  3. Thanks Phillip.

    For my future reference where can I look to find out what all these switches
    mean?

    "Phillip Williams" wrote:

    > ^(\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*\b([,;]\s?)?)*$
    > --
    > HTH,
    > Phillip Williams
    > http://www.societopia.net
    > http://www.webswapp.com
    >
    >
    > "SAL" wrote:
    >
    > > I am using a RegularExpressionValidator control on my ASP page, and I have
    > > the ValidationExpression property set to "Internet E-mail Address". The
    > > email address is valiated when the user puts in a email addess in the TextBox.
    > >
    > > This works fine until I have multiple email addresses. How can I validate
    > > multiple e-mail addresses seperated by a "," or ";"? The following
    > > ValidationExpression will validate up to 2 email addresses but not anymore:
    > >
    > > \w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*([,;]\s*\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*
    > >
    > > Any suggestion would be helpful. The number of emails could be infinite,
    > > but I think the max will be 10 at most.
    > >
    > > Thanks,
    > >
     
    =?Utf-8?B?U0FM?=, Feb 27, 2006
    #3
  4. The only references I have ever used on Regular Expressions were these ones
    on the MSDN
    http://msdn.microsoft.com/library/d...de/html/cpconRegularExpressionsAsLanguage.asp

    http://msdn.microsoft.com/library/d...html/ab0766e1-7037-45ed-aa23-706f58358c0e.asp

    There are however some more popular sites that I saw their links posted on
    this newsgroup frequently such as http://www.regexplib.com/

    --
    HTH,
    Phillip Williams
    http://www.societopia.net
    http://www.webswapp.com


    "SAL" wrote:

    > Thanks Phillip.
    >
    > For my future reference where can I look to find out what all these switches
    > mean?
    >
    > "Phillip Williams" wrote:
    >
    > > ^(\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*\b([,;]\s?)?)*$
    > > --
    > > HTH,
    > > Phillip Williams
    > > http://www.societopia.net
    > > http://www.webswapp.com
    > >
    > >
    > > "SAL" wrote:
    > >
    > > > I am using a RegularExpressionValidator control on my ASP page, and I have
    > > > the ValidationExpression property set to "Internet E-mail Address". The
    > > > email address is valiated when the user puts in a email addess in the TextBox.
    > > >
    > > > This works fine until I have multiple email addresses. How can I validate
    > > > multiple e-mail addresses seperated by a "," or ";"? The following
    > > > ValidationExpression will validate up to 2 email addresses but not anymore:
    > > >
    > > > \w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*([,;]\s*\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*
    > > >
    > > > Any suggestion would be helpful. The number of emails could be infinite,
    > > > but I think the max will be 10 at most.
    > > >
    > > > Thanks,
    > > >
     
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=, Feb 27, 2006
    #4
  5. Great. Thanks again Phillip.

    That website you referenced is where I first found somewhat what I was
    trying to do. After I sent my question out to this discussion board I got it
    working. However, you solution was a better and not as long as mine so I use
    it instead. I made a slight modification to it, so it would accept IP
    addresses in the domain as well.

    Thanks again.

    "Phillip Williams" wrote:

    > The only references I have ever used on Regular Expressions were these ones
    > on the MSDN:
    > http://msdn.microsoft.com/library/d...de/html/cpconRegularExpressionsAsLanguage.asp
    >
    > http://msdn.microsoft.com/library/d...html/ab0766e1-7037-45ed-aa23-706f58358c0e.asp
    >
    > There are however some more popular sites that I saw their links posted on
    > this newsgroup frequently such as http://www.regexplib.com/
    >
    > --
    > HTH,
    > Phillip Williams
    > http://www.societopia.net
    > http://www.webswapp.com
    >
    >
    > "SAL" wrote:
    >
    > > Thanks Phillip.
    > >
    > > For my future reference where can I look to find out what all these switches
    > > mean?
    > >
    > > "Phillip Williams" wrote:
    > >
    > > > ^(\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*\b([,;]\s?)?)*$
    > > > --
    > > > HTH,
    > > > Phillip Williams
    > > > http://www.societopia.net
    > > > http://www.webswapp.com
    > > >
    > > >
    > > > "SAL" wrote:
    > > >
    > > > > I am using a RegularExpressionValidator control on my ASP page, and I have
    > > > > the ValidationExpression property set to "Internet E-mail Address". The
    > > > > email address is valiated when the user puts in a email addess in the TextBox.
    > > > >
    > > > > This works fine until I have multiple email addresses. How can I validate
    > > > > multiple e-mail addresses seperated by a "," or ";"? The following
    > > > > ValidationExpression will validate up to 2 email addresses but not anymore:
    > > > >
    > > > > \w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*([,;]\s*\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*
    > > > >
    > > > > Any suggestion would be helpful. The number of emails could be infinite,
    > > > > but I think the max will be 10 at most.
    > > > >
    > > > > Thanks,
    > > > >
     
    =?Utf-8?B?U0FM?=, Feb 27, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Duke of Hazard
    Replies:
    0
    Views:
    760
    Duke of Hazard
    Jan 23, 2004
  2. Kelly
    Replies:
    1
    Views:
    425
    The Durban Towel
    Apr 28, 2004
  3. UndoMiel
    Replies:
    8
    Views:
    1,797
    Brian Palmer
    Aug 8, 2004
  4. bruce
    Replies:
    4
    Views:
    755
    Cameron Laird
    Sep 22, 2006
  5. namespace1
    Replies:
    3
    Views:
    906
Loading...

Share This Page