Imports System
Imports System.Configuration
Class UsingRegexStringValidator
Public Shared Sub Main()
Dim testString As String = "someone@example.com"
Dim regexString As String = "^[a-zA-Z\.\-_]+@([a-zA-Z\.\-_]+\.)+[a-zA-Z]{2,4}$"
Dim myRegexValidator As RegexStringValidator = _
New RegexStringValidator(regexString)
Console.WriteLine("CanValidate: {0}",myRegexValidator.CanValidate(testString.GetType()))
Try
myRegexValidator.Validate(testString)
Console.WriteLine("Validated.")
Catch e As Exception
Console.WriteLine("Error: {0}", e.Message.ToString())
End Try
Console.ReadLine()
End Sub
End Class