Validate Email Address Using Regular Expressions

R

Ryan

HELLO
I am using the following MICROSOFT SUGGESTED (somewhere on msdn)
regular expression to validate email addresses however I understand
that the RFP allows for "+" symbols in the email address and this
method does not....

Does anyone have an explanation?


Function IsValidEmail(ByVal strIn As String) As Boolean
' Return true if strIn is in valid e-mail format.
Return Regex.IsMatch(strIn,
("^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"))
End Function


THANKS
RYAN
 
A

Arne Janning

Hi Ryan!

I am using the following MICROSOFT SUGGESTED (somewhere on msdn)
regular expression to validate email addresses however I understand
that the RFP allows for "+" symbols in the email address and this
method does not....

Does anyone have an explanation?

A real RFC-822-compliant regex ist very big and complicated.

Have a look at this:
http://www.codeproject.com/csharp/RFC822Validator.asp

This is the one and only RFC-822-compliant regex:

[\040\t]*(?: \( [^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\
xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] *)*\))
[^\\\x80-\xff\
n\015()] *)*\)
[\040\t]* )*(?'mailbox'(?'localpart'(?:[^(\040)<>\@,;:\".\\\[\]\0
00-\037\x80-\xff]+(?![^(\040)<>\@,;:\".\\\[\]\000-\037\x80-\xff])|(?'quotedstr'\
"[^\\\x80-\xff\n\015"] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )*\"))
[\04
0\t]*(?: \( [^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\
n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] *)*\))
[^\\\x80-\xff\n\01
5()] *)*\) [\040\t]* )*(?:\. [\040\t]*(?: \( [^\\\x80-\xff\n\015()] *(?:(?:
\\
[^\x80-\xff] | \( [^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff]
[^\\\x80-\xff\n
\015()] *)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*
(?:[^(\040)<>\@,;:\".\\
\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\".\\\[\]\000-\037\x80-\xff])|(?'quote
dstr'\"[^\\\x80-\xff\n\015"] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"]
* )*\")
) [\040\t]*(?: \( [^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80
-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] *)*\))
[^\\\x80-\xf
f\n\015()] *)*\) [\040\t]* )*)*) \@ [\040\t]*(?: \( [^\\\x80-\xff\n\015()]
*(?:(
?: \\ [^\x80-\xff] | \( [^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff]
[^\\\x80
-\xff\n\015()] *)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*
(?'domain'(?:[^(
\040)<>\@,;:\".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\".\\\[\]\000-\037\x8
0-\xff])|\[(?: [^\\\x80-\xff\n\015\[\]"] | \\
^\x80-\xff] )*\])[\040\t]*(?: \
( [^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *
(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] *)*\)) [^\\\x80-\xff\n\015()]
*)*\)
[\040\t]* )*:)?\. [\040\t]*(?: \( [^\\\x80-\xff\n\015()] *(?:(?: \\
[^\x80-\xf
f] | \( [^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff]
[^\\\x80-\xff\n\015()] *)
*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*
(?:[^(\040)<>\@,;:\".\\\[\]\000-\
037\x80-\xff]+(?![^(\040)<>\@,;:\".\\\[\]\000-\037\x80-\xff])|\[(?:
[^\\\x80-\xf
f\n\015\[\]"] | \\ [^\x80-\xff] )*\])[\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(
?:(?: \\ [^\x80-\xff] | \( [^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff]
[^\\\
x80-\xff\n\015()] *)*\)) [^\\\x80-\xff\n\015()] *)*\)
[\040\t]* )*)*)|(?:[^(\040
)<>\@,;:\".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\".\\\[\]\000-\037\x80-\x
ff])|(?'quotedstr'\"[^\\\x80-\xff\n\015"] *(?: \\ [^\x80-\xff]
[^\\\x80-\xff\n\
015"] * )*\"))[^()<>\@,;:\".\\\[\]\x80-\xff\000-\010\012-\037](?:(?: \(
[^\\\x80
-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \( [^\\\x80-\xff\n\015()] *(?: \\
[^\
x80-\xff] [^\\\x80-\xff\n\015()] *)*\)) [^\\\x80-\xff\n\015()] *)*\) |
(?'quot
edstr'\"[^\\\x80-\xff\n\015"] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"]
* )*\"
) )[^()<>\@,;:\".\\\[\]\x80-\xff\000-\010\012-\037] *)* < [\040\t]*(?: \(
[^\\\x
80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \( [^\\\x80-\xff\n\015()] *(?:
\\ [
^\x80-\xff] [^\\\x80-\xff\n\015()] *)*\)) [^\\\x80-\xff\n\015()] *)*\)
[\040\t
]* )*(?: \@ [\040\t]*(?: \( [^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff]
| \
( [^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^
\\\x80-\xff\n\015()] *)*\) [\040\t]* )*
(?'domain'(?:[^(\040)<>\@,;:\".\\\[\]\00
0-\037\x80-\xff]+(?![^(\040)<>\@,;:\".\\\[\]\000-\037\x80-\xff])|\[(?:
[^\\\x80-
\xff\n\015\[\]"] | \\ [^\x80-\xff] )*\])[\040\t]*(?: \(
[^\\\x80-\xff\n\015()]
*(?:(?: \\ [^\x80-\xff] | \( [^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff]
[^
\\\x80-\xff\n\015()] *)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*:)?\.
[\040
\t]*(?: \( [^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n
\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] *)*\))
[^\\\x80-\xff\n\015
()] *)*\) [\040\t]* )*
(?:[^(\040)<>\@,;:\".\\\[\]\000-\037\x80-\xff]+(?![^(\040
)<>\@,;:\".\\\[\]\000-\037\x80-\xff])|\[(?: [^\\\x80-\xff\n\015\[\]"] | \\
[^\x
80-\xff] )*\])[\040\t]*(?: \( [^\\\x80-\xff\n\015()] *(?:(?: \\
[^\x80-\xff]
| \( [^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\))
[^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*)*)(?: , [\040\t]*(?: \(
[^\\\x80-\xff
\n\015()] *(?:(?: \\ [^\x80-\xff] | \( [^\\\x80-\xff\n\015()] *(?: \\
[^\x80-\
xff] [^\\\x80-\xff\n\015()] *)*\)) [^\\\x80-\xff\n\015()] *)*\)
[\040\t]* )* \
@ [\040\t]*(?: \( [^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80
-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] *)*\))
[^\\\x80-\xf
f\n\015()] *)*\) [\040\t]* )*
(?'domain'(?:[^(\040)<>\@,;:\".\\\[\]\000-\037\x80
-\xff]+(?![^(\040)<>\@,;:\".\\\[\]\000-\037\x80-\xff])|\[(?:
[^\\\x80-\xff\n\015
\[\]"] | \\ [^\x80-\xff] )*\])[\040\t]*(?: \( [^\\\x80-\xff\n\015()]
*(?:(?:
\\ [^\x80-\xff] | \( [^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff]
[^\\\x80-\xf
f\n\015()] *)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*:)?\.
[\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(
?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] *)*\)) [^\\\x80-\xff\n\015()]
*)*\)
[\040\t]* )*
(?:[^(\040)<>\@,;:\".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\"
..\\\[\]\000-\037\x80-\xff])|\[(?: [^\\\x80-\xff\n\015\[\]"] | \\
[^\x80-\xff]
)*\])[\040\t]*(?: \( [^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\
x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] *)*\))
[^\\\x80-
\xff\n\015()] *)*\) [\040\t]* )*)*))*:[\040\t]*(?: \( [^\\\x80-\xff\n\015()]
*(?
:(?: \\ [^\x80-\xff] | \( [^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff]
[^\\\x
80-\xff\n\015()] *)*\)) [^\\\x80-\xff\n\015()] *)*\)
[\040\t]* )* )?(?'localpart
'(?:[^(\040)<>\@,;:\".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\".\\\[\]\000-
\037\x80-\xff])|(?'quotedstr'\"[^\\\x80-\xff\n\015"] *(?: \\ [^\x80-\xff]
[^\\\
x80-\xff\n\015"] * )*\")) [\040\t]*(?: \( [^\\\x80-\xff\n\015()] *(?:(?: \\
[^\
x80-\xff] | \( [^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff]
[^\\\x80-\xff\n\01
5()] *)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*(?:\. [\040\t]*(?: \(
[^\\\
x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \( [^\\\x80-\xff\n\015()] *(?:
\\
[^\x80-\xff] [^\\\x80-\xff\n\015()] *)*\)) [^\\\x80-\xff\n\015()] *)*\)
[\040\
t]* )*
(?:[^(\040)<>\@,;:\".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\".\\\[\
]\000-\037\x80-\xff])|(?'quotedstr'\"[^\\\x80-\xff\n\015"] *(?: \\
[^\x80-\xff]
[^\\\x80-\xff\n\015"] * )*\")) [\040\t]*(?: \( [^\\\x80-\xff\n\015()]
*(?:(?:
\\ [^\x80-\xff] | \( [^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff]
[^\\\x80-\xf
f\n\015()] *)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*)*) \@
[\040\t]*(?: \
( [^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *
(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] *)*\)) [^\\\x80-\xff\n\015()]
*)*\)
[\040\t]* )*
(?'domain'(?:[^(\040)<>\@,;:\".\\\[\]\000-\037\x80-\xff]+(?![^(\04
0)<>\@,;:\".\\\[\]\000-\037\x80-\xff])|\[(?: [^\\\x80-\xff\n\015\[\]"] | \\
[^\
x80-\xff] )*\])[\040\t]*(?: \( [^\\\x80-\xff\n\015()] *(?:(?: \\
[^\x80-\xff]
| \( [^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)
) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*:)?\. [\040\t]*(?: \(
[^\\\x80-\xff\n
\015()] *(?:(?: \\ [^\x80-\xff] | \( [^\\\x80-\xff\n\015()] *(?: \\
[^\x80-\xf
f] [^\\\x80-\xff\n\015()] *)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*
(?:
[^(\040)<>\@,;:\".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\".\\\[\]\000-\037
\x80-\xff])|\[(?: [^\\\x80-\xff\n\015\[\]"] | \\
^\x80-\xff] )*\])[\040\t]*(?
: \( [^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()
] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] *)*\))
[^\\\x80-\xff\n\015()] *)
*\) [\040\t]* )*)*)>)

Cheers

Arne Janning
 
H

Herfried K. Wagner [MVP]

Ryan said:
I have anothing post somewhere asking a similar question...

1) will this regular expression work for all languages?

What do you mean with "languages"? Programming languages or natural
languages? Yes, it will work with all natural languages, and all
programming languages that support the same regular expression syntax with
the same semantics put on the syntax.
2) should I use the full regular expression and why don't
people use the full regular expression?

'cause they never read the RFC.
3) will the full expression handle all cases? Should I be
less strict with my validation.... are there email systems
that don't follow this standard?

This regular expression will handle all cases, and all RFC-compliant mail
systems will follow this standard.
 
R

Ryan

Obviously I need to read the RFP... my language question was in
reference to my question to whether an email in Chinese would work;
sounds like it does.

I asked the second question wondering if people didnt use the full
expression because of the speed of the validation.

Thanks Herfried
Ryan
 
R

Ryan

I want to validate email addresses in iebms to the standard RFC 822 or
something like that. This regular expression was recommended and will
work… however for some reason it always returns false…



Besides making double quotes two double quotes, I didn't change the
expression. I did that so the string would work.



Any help?



Ryan





Public Function ValidateEmail(ByVal astrEmailAddress As String) As
Boolean

Return System.Text.RegularExpressions.Regex.IsMatch(astrEmailAddress,
("^[\040\t]*(?: \( [^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] |
\( [^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff]
[^\\\x80-\xff\n\015()] *)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]*
)*(?'mailbox'(?'localpart'(?:[^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff])|(?'quotedstr'\""[^\\\x80-\xff\n\015""]
*(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015""] * )*\"")) [\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*(?:\. [\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\[^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*
(?:[^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff])|(?'quotedstr'\""[^\\\x80-\xff\n\015""]
*(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015""] * )*\"")) [\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*)*) \@ [\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*
(?'domain'(?:[^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff])|\[(?:
[^\\\x80-\xff\n\015\[\]""] | \\ [^\x80-\xff] )*\])[\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*:)?\. [\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*
(?:[^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff])|\[(?:
[^\\\x80-\xff\n\015\[\]""] | \\ [^\x80-\xff] )*\])[\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]*
)*)*)|(?:[^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff])|(?'quotedstr'\""[^\\\x80-\xff\n\015""]
*(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015""] *
)*\""))[^()<>\@,;:\"".\\\[\]\x80-\xff\000-\010\012-\037](?:(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) |
(?'quotedstr'\""[^\\\x80-\xff\n\015""] *(?: \\ [^\x80-\xff]
[^\\\x80-\xff\n\015""] * )*\"")
)[^()<>\@,;:\"".\\\[\]\x80-\xff\000-\010\012-\037] *)* < [\040\t]*(?:
\( [^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*(?: \@ [\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*
(?'domain'(?:[^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff])|\[(?:
[^\\\x80-\xff\n\015\[\]""] | \\ [^\x80-\xff] )*\])[\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*:)?\. [\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*
(?:[^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff])|\[(?:
[^\\\x80-\xff\n\015\[\]""] | \\ [^\x80-\xff] )*\])[\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff]| \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*)*)(?: , [\040\t]*(?:
\( [^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )* \@ [\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*
(?'domain'(?:[^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff])|\[(?:
[^\\\x80-\xff\n\015\[\]""] | \\ [^\x80-\xff] )*\])[\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?:\\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*:)?\. [\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\)[\040\t]* )*
(?:[^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff])|\[(?:
[^\\\x80-\xff\n\015\[\]""] | \\ [^\x80-\xff])*\])[\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*)*))*:[\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*
)?(?'localpart'(?:[^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff])|(?'quotedstr'\""[^\\\x80-\xff\n\015""]
*(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015""] * )*\"")) [\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*(?:\. [\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\[^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*
(?:[^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff])|(?'quotedstr'\""[^\\\x80-\xff\n\015""]
*(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015""] * )*\"")) [\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?:\\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*)*) \@ [\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*
(?'domain'(?:[^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff])|\[(?:
[^\\\x80-\xff\n\015\[\]""] | \\ [^\x80-\xff] )*\])[\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*:)?\. [\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*
(?:[^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>\@,;:\"".\\\[\]\000-\037\x80-\xff])|\[(?:
[^\\\x80-\xff\n\015\[\]""] | \\ [^\x80-\xff] )*\])[\040\t]*(?: \(
[^\\\x80-\xff\n\015()] *(?:(?: \\ [^\x80-\xff] | \(
[^\\\x80-\xff\n\015()] *(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()]
*)*\)) [^\\\x80-\xff\n\015()] *)*\) [\040\t]* )*)*)>)$"))

End Function
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top