Checking a field DOES NOT contain an email address

Last post 12-14-2007 11:45 AM by SKVSKV. 2 replies.

Sort Posts:

  • Checking a field DOES NOT contain an email address

    12-14-2007, 7:06 AM
    • Loading...
    • AndyBanks
    • Joined on 12-18-2006, 12:39 PM
    • Posts 3

    Hi,

    I have an TextBox control on my WebForm and I need to validate it to ensure it isn't an email address. I know how to use a RegEx validator to check IT IS an email address but how would I validate it to check it IS NOT an email address?

    Thanks in advance.
    Andy
     

  • Re: Checking a field DOES NOT contain an email address

    12-14-2007, 11:40 AM
    Answer
    • Loading...
    • SKVSKV
    • Joined on 11-17-2007, 1:52 PM
    • Canada
    • Posts 182

    Hi AndyBanks

    Please refer to this article:   http://www.codetoad.com/asp_email_reg_exp.asp. It uses Pattern to find out if the test is a regular expression. You can write a custom validator and then give an error message if the text contains an email pattern.

    Please remember to Mark this post as Answered if it serves your purpose so that issue can be closed and others can refer.
  • Re: Checking a field DOES NOT contain an email address

    12-14-2007, 11:45 AM
    • Loading...
    • SKVSKV
    • Joined on 11-17-2007, 1:52 PM
    • Canada
    • Posts 182

    You can also try using Reg Expression Validator and add !  (not) infornt of the regular expression for the email. I have not tried this but it may work.

    Please remember to Mark this post as Answered if it serves your purpose so that issue can be closed and others can refer.
Page 1 of 1 (3 items)