I have a table with 30,000 records. I'd like to use this http://www.regular-expressions.info/email.html
to query my email fields (show invalid emails). I'd like to use the
first expression listed on that site. How do I proceed?
On Sun, 16 May 2010 18:52:30 -0700 (PDT), Song <[email protected]>
wrote:
Write a public function in a standard module:
Public Function TestEmail(myEmailField as string) as Boolean
Dim pattern As String
pattern = "\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b"
Dim r As RegExp 'Requires a reference to Microsoft VBScript
Regular Expressions 5.5
Set r = New RegExp
r.pattern = pattern
r.IgnoreCase = True
TestEmail = r.test(myEmailField )
set r = nothing
end function
Then call this function from your query:
select *, TestEmail(myEmailField) as IsValidEmail from myTable