Permalink
Cannot retrieve contributors at this time
Fetching contributors…
| ' Visual Basic .NET Document | |
| Option Strict On | |
| ' <Snippet1> | |
| Imports System.Text.RegularExpressions | |
| Module Example | |
| Public Sub Main() | |
| Dim pattern As String = "(\w+)\s(\1)\W" | |
| Dim input As String = "He said that that was the the correct answer." | |
| For Each match As Match In Regex.Matches(input, pattern, RegexOptions.IgnoreCase) | |
| Console.WriteLine("Duplicate '{0}' found at positions {1} and {2}.", _ | |
| match.Groups(1).Value, match.Groups(1).Index, match.Groups(2).Index) | |
| Next | |
| End Sub | |
| End Module | |
| ' The example displays the following output: | |
| ' Duplicate 'that' found at positions 8 and 13. | |
| ' Duplicate 'the' found at positions 22 and 26. | |
| ' </Snippet1> |