Capture Class represents the results from a single successful subexpression capture.
Imports System.Text.RegularExpressions
Module Example
Public Sub Main()
Dim input As String = "this is a test."
Dim pattern As String = "((\w+)[\s.])+"
For Each match As Match In Regex.Matches(input, pattern)
Console.WriteLine("Match: {0}", match.Value)
For groupCtr As Integer = 0 To match.Groups.Count - 1
Dim group As Group = match.Groups(groupCtr)
Console.WriteLine(" Group {0}: {1}", groupCtr, group.Value)
For captureCtr As Integer = 0 To group.Captures.Count - 1
Console.WriteLine(" Capture {0}: {1}", captureCtr,group.Captures(captureCtr).Value)
Next
Next
Next
End Sub
End Module
Related examples in the same category