IsEmail
Module MyExtensions <System.Runtime.CompilerServices.Extension()> _ Public Function IsEmail(ByVal text As String) As Boolean Dim Expression As New System.Text.RegularExpressions.Regex("\S+@\S+\.\S+", System.Text.RegularExpressions.RegexOptions.Compiled) If Expression.IsMatch(text) Then Return True Else Return False End If End Function End ModuleExample:
if textbox1.text.IsEmail then sendmail(message) end if
Description
Extend string with boolean test for a valid email address
Details
- Author: Jim Tripp
- Submitted on: 31-5-2010 12:20:37
- Language: VB
- Type: System.string
- Views: 3469
Double click on the code to select all.