Results 1 to 7 of 7

Thread: Manually Check Email Address Validity

  1. #1

    Thread Starter
    Hyperactive Member stingrae's Avatar
    Join Date
    Apr 2002
    Location
    Sydney
    Posts
    401

    Resolved Manually Check Email Address Validity

    I am validating an online form, and naturally one of the fields to validate is an email address.

    Does anybody have a function available that checks the validay of a string to be a valid email address?

    Unfortunately I need a bit more flexibility than is provided by the RegularExpressionValidator object - unless I can somehow call it without hard binding it (if that makes sense).

    I can see that the following is used by this control as the Email format:

    \w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

    Any ideas?
    Last edited by stingrae; Oct 27th, 2005 at 09:19 PM. Reason: Resolved
    "The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.

    Windows & Web Developer
    Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
    Sutherland Shire, Sydney Australia
    www.stingrae.com.au
    Developer of Arnold - Gym & Martial Arts Database Management System
    www.gymdatabase.com.au

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Manually Check Email Address Validity

    What is the additional flexibility that you need? Are you trying to limit domains or something like that?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member stingrae's Avatar
    Join Date
    Apr 2002
    Location
    Sydney
    Posts
    401

    Re: Manually Check Email Address Validity

    No, I just want to be able to check from within a code block. Like if strXYZ is aValidEmail then do suchandsuch .... i don't actually want to validate a text box...
    "The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.

    Windows & Web Developer
    Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
    Sutherland Shire, Sydney Australia
    www.stingrae.com.au
    Developer of Arnold - Gym & Martial Arts Database Management System
    www.gymdatabase.com.au

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Manually Check Email Address Validity

    You would just use a System.Text.RegularExpressions.Regex object with the same regular expression.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Hyperactive Member stingrae's Avatar
    Join Date
    Apr 2002
    Location
    Sydney
    Posts
    401

    Re: Manually Check Email Address Validity

    cool... thanks. i had never seen that before and was just what i was after....

    R

    ps.... takes another aussie to solve my prob. cheers mate!
    "The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.

    Windows & Web Developer
    Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
    Sutherland Shire, Sydney Australia
    www.stingrae.com.au
    Developer of Arnold - Gym & Martial Arts Database Management System
    www.gymdatabase.com.au

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Manually Check Email Address Validity

    My ex-wife actually went to the same school as Micheal Hutchence. He's practically my brother. I don't know Kevin Bacon though.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Manually Check Email Address Validity

    Why you shouldn't use RegEx to validate email addresses

    And here is the RFC 822 standard for email addresses, although it doesn't provide an implementation of validating them.

    It's actually quite a complex operation, as this thread will attest.

    Anyway, HTH


    Edit: I don't know what fool decided to put acronyms in the word filter, but in the last link, replace the asterisk'ed letters with W, T, and F, in that order

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width