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?
Re: Manually Check Email Address Validity
What is the additional flexibility that you need? Are you trying to limit domains or something like that?
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...
Re: Manually Check Email Address Validity
You would just use a System.Text.RegularExpressions.Regex object with the same regular expression.
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!
Re: Manually Check Email Address Validity
My ex-wife actually went to the same school as Micheal Hutchence. He's practically my brother. :D I don't know Kevin Bacon though.
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 ;)