Mega Code Archive

 
Categories / VB.Net / Development
 

Demonstrating Class Regex

Imports System.Text.RegularExpressions Imports System Public Class MainClass    Shared Sub Main()       Dim myMatch As Match       ' create regular expression       Dim expression As Regex = _          New Regex("J.*\d[0-35-9]-\d\d-\d\d")       Dim string1 As String = "05-12-75" & _          vbCrLf & "11-04-68" & vbCrLf & _          "04-28-73" & vbCrLf & _          "12-17-77"       ' match regular expression to string and         ' print out all matches       For Each myMatch In expression.Matches(string1)          Console.WriteLine( myMatch.ToString() )       Next   End Sub ' Main End Class