[AccessD] email validation

MartyConnelly martyconnelly at shaw.ca
Sun Jan 8 15:12:35 CST 2006


Here is some vb code to validate email addresses subject to a free daily 
limit or paid for
via smtp mail server authentication at www.internetfrog.com

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=1&txtCodeId=63971

Gustav Brock wrote:

>Hi Jim
>
>Here's another pattern:
>
>^(?:[\w\!\#\$\%\&'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&'\*\+\-\/\=\?
>\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]? 
>\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{
>1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$
>
>which claims to have a proven record (browse to 2004-04-28, 7:48 pm):
>
>http://www.codecomments.com/archive299-2004-4-184908.html 
>
>However, it fails for me - and I don't have the need to debug it.
>
>Note that addresses may have a subdomain like:
>
>  submit.ry8JtxnVhqqmpAFS at spam.spamcop.net
>
>/gustav
>
>
>  
>
>>>>martyconnelly at shaw.ca 07-01-2006 07:35 >>>
>>>>        
>>>>
>There is quite a range of vaild email addresses including the old X400 types
>Mastering Regular Expressions.  Is the best Owl book for regexp
>
> The book ends with an example regular expression to match
>an email address.  Its a 16,000+ byte regular expression.  Just shows
>the scope of such a match when you want to get an email address "from
>the wild".
>This should verify or catch about 90-95% using regexp
>
> Function testEmail(strEmail As String) As Boolean
>
> If IsEmail(strEmail) Then
> ' email address ok
>  Debug.Print "OK"
>  testEmail = True
> Else
> ' email address not ok
>  Debug.Print "False"
>
> End If
> End Function
> Function IsEmail(strText as String)
> 'Need to Set reference to Microsoft VBScript Regular Expressions 5.5 
>vbscript.dll/3
>'or set for 5.6
> Dim regEx as Object
> Set regEx = New RegExp
> regEx.Pattern = "^[\w\-\._]+@[\w\-]{2,}(\.[\w\-]{2,})+$"
> 'or               "^([\w-_]+\.)*[\w-_]+\@ ([\w-_]+\.)+[a-zA-Z]{2,3}$"
> regEx.ignoreCase = True
> regEx.Global = True
> IsEmail = regEx.Test(strText)
> End Function
>
>
>
>Jim Moss wrote:
>
>  
>
>>Does anyone have a good email validation module that they would be willing to share?
>>    
>>
>
>
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada






More information about the AccessD mailing list