email validation

Discussion in 'ASP .Net Datagrid Control' started by anonymous, Mar 8, 2005.

  1. anonymous

    anonymous Guest

    The following expression I am using to validate an email.
    However when empty spaces entered at the end of email it
    is recognized as invalid email. How do I fix this problem?
    ^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*
    [0-9a-zA-Z])*\.)+[a-zA-Z]
    {2,9})$
     
    anonymous, Mar 8, 2005
    #1
    1. Advertising

  2. anonymous

    Paul D. Fox Guest

    Here's an easier method....
    Just go to http://regexlib.com/ and lookup "e-mail validation" and copy one
    of the expressions already written there.

    Paul

    "anonymous" <> wrote in message
    news:5bb901c523f3$bff31090$...
    > The following expression I am using to validate an email.
    > However when empty spaces entered at the end of email it
    > is recognized as invalid email. How do I fix this problem?
    > ^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*
    > [0-9a-zA-Z])*\.)+[a-zA-Z]
    > {2,9})$
     
    Paul D. Fox, Mar 8, 2005
    #2
    1. Advertising

  3. anonymous

    anonymous Guest

    I could not find any expression which will validate email
    liek this:
    < >.
    As you can see I have some empty spaces after actual email
    and I can't find the expression to validate email as well
    as taking the space out.
    Thanks
     
    anonymous, Mar 9, 2005
    #3
  4. anonymous

    JohnFol Guest

    You could always do a trim on the email field

    "anonymous" <> wrote in message
    news:5bb901c523f3$bff31090$...
    > The following expression I am using to validate an email.
    > However when empty spaces entered at the end of email it
    > is recognized as invalid email. How do I fix this problem?
    > ^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*
    > [0-9a-zA-Z])*\.)+[a-zA-Z]
    > {2,9})$
     
    JohnFol, Mar 9, 2005
    #4
  5. anonymous

    anonymous Guest

    I am a little bit confused...here is my code... where I
    should trim???
    <asp:RegularExpressionValidator id="reEmail"
    runat="server" CssClass="error_message" ErrorMessage="You
    must enter a valid Email address."

    ControlToValidate="txtEmailAddress"
    ValidationExpression="^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@
    (([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})
    $"></asp:RegularExpressionValidator>
     
    anonymous, Mar 9, 2005
    #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. Peter
    Replies:
    0
    Views:
    3,412
    Peter
    Jul 1, 2003
  2. John Silver
    Replies:
    0
    Views:
    627
    John Silver
    Feb 4, 2005
  3. Tee

    Email ErrorPage to email

    Tee, Jun 23, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    392
  4. Replies:
    3
    Views:
    560
    AdamM
    Jul 27, 2004
  5. Chuck Amadi
    Replies:
    2
    Views:
    416
    chuck amadi
    Jun 6, 2004
Loading...

Share This Page