Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Simple Regular Expressions Tester
Author:
Gehan Fernando
E-mail:
Click to e-mail author
Submitted:
9/10/2007
Version:
VB 2005
Compatibility:
VB 2005, VB 2008
Category:
Forms
Views:
8455
Simple Regular Expressions Tester.
Declarations:
Imports System.Text.RegularExpressions
Code:
Public Class Form1 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
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement