VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Simple Regular Expressions Tester ....

by Gehan Fernando (47 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB.NET
Difficulty: Unknown Difficulty
Originally Published: Sun 9th December 2007
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Simple Regular Expressions Tester ....

Rate Simple Regular Expressions Tester ....




    Private Function TestRegularExpression(ByVal TestValue As Object, ByVal TestPattern As String) As Boolean

        TestRegularExpression = False

        If Regex.IsMatch(TestValue, TestPattern) Then
            TestRegularExpression = True
        Else
            TestRegularExpression = False
        End If

        Return TestRegularExpression

    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim Ans As Boolean = False

        Try

            Ans = TestRegularExpression(TextBox2.Text.ToString().Trim(), TextBox1.Text.ToString().Trim())

            If Ans = True Then
                MessageBox.Show("Correct", "Regular Expressions", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Else
                MessageBox.Show("Not Correct", "Regular Expressions", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            End If

        Catch ex As Exception

            MessageBox.Show(ex.Message, "Error ...", MessageBoxButtons.OK, MessageBoxIcon.Error)

        End Try
        

    End Sub

End Class

Download this snippet    Add to My Saved Code

Simple Regular Expressions Tester .... Comments

No comments have been posted about Simple Regular Expressions Tester ..... Why not be the first to post a comment about Simple Regular Expressions Tester .....

Post your comment

Subject:
Message:
0/1000 characters