Regular Expression to validate Email address

Pass a string as a parameter to the below procedure to check whether the string is a valid email id or not.
Public Function blnEmailValid(ByVal strEmailAdd As String) As Boolean With CreateObject("VBScript.RegExp") .IgnoreCase = True .Global = True .Pattern = "^([a-zA-Z0-9_\-\.]+)@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$" blnEmailValid = .Test(strEmailAdd) End With End Function Sub Test() MsgBox blnEmailValid("abc@EE.com") End Sub
»
- Vishesh's blog
- Add new comment
- 1059 reads

Recent comments
9 hours 32 min ago
20 hours 54 min ago
1 day 10 hours ago
1 day 10 hours ago
1 day 13 hours ago
1 day 23 hours ago
2 days 2 hours ago
2 days 3 hours ago
2 days 9 hours ago
2 days 10 hours ago