ok , thats because you have a "/" at the end of the domain, so to accept that modify the Regex as per the code below;
Code:Dim Info() As String = System.IO.File.ReadAllLines("MyFile.txt") Dim Sites As New List(Of String) Dim Hits As New List(Of Integer) Dim matches As MatchCollection For Each s As String In Info Dim r As New Regex( _ "(?<=http://www.)[A-Z0-9.-]+\.(?:[A-Z]{2}|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum)(?=/\s)", _ RegexOptions.IgnoreCase Or RegexOptions.Singleline) matches = r.Matches(s) If matches.Count > 0 Then Dim Domain As String = matches(0).ToString If Not Sites.Contains(Domain) Then Sites.Add(Domain) Hits.Add(1) Else Hits(Sites.IndexOf(Domain)) += 1 End If Else 'No domain was found on the line End If Next Dim Str As String = String.Empty For i As Integer = 0 To Sites.Count - 1 Str += Sites(i) & " has " & Hits(i).ToString & " hits" & ControlChars.NewLine Next MessageBox.Show(Str)




Reply With Quote