Mega Code Archive

 
Categories / VB.Net / Development
 

Regular Expressions Match

Imports System Imports System.Text.RegularExpressions Public Class MainClass    Shared Sub Main()         Dim pattern As String = "g"         Dim AString As String = "a string"                  Dim reg_exp As New Regex(pattern)         Dim matches As MatchCollection                  matches = reg_exp.Matches(AString)         Console.WriteLine(AString)                  For Each a_match As Match In matches             Console.WriteLine("Index " & a_match.Index)             Console.WriteLine("Length " & a_match.Length)         Next a_match    End Sub  End Class