If the email is always enclosed in the final <>
you could
Public Function fmt(email As String) As String
pos = InStrRev(email, "<")
If (pos > 0) Then
email = Mid$(email, 1 + pos, 1 + Len(email) - pos)
email = Left$(email, Len(email) - 1)
End If
fmt = email
End Function
or
replace(mid(email,instrrev(email,"<")+1,len(email)),">","")
Edit;
For a regexp check add a reference to the "Microsoft VBScript Regular Expressions library" (tools > references) and;
Public Function fmt(email As String) As String
pos = InStrRev(email, "<")
If (pos > 0) Then
email = Mid$(email, 1 + pos, 1 + Len(email) - pos)
email = Left$(email, Len(email) - 1)
End If
fmt = email
With New RegExp
.Global = True
.IgnoreCase = True
.MultiLine = True
.Pattern = "^\S+@\S+\.\S+$"
If Not .Test(fmt) Then fmt = ""
End With
End Function
This returns a valid email address, or "" if its not valid.
I dropped your RE; reasoning: Using a regular expression to validate an email address