Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Parse HTML file index.html

Avatar of jedistar
jedistarFlag for Singapore asked on
Visual Basic.NET
6 Comments1 Solution254 ViewsLast Modified:

For example: <a href="http://www/x.html">Visit Me</a>

Currently my below code only parse for the HTML links and does not read "Visit Me". It only grabs the http link.
How do i grab both the link and the "Visit Me" title, my code is as follows:

  Public Function ParseLinks(ByVal HTML As String) As String
            ' Remember to add the following at top of class:
            ' - Imports System.Text.RegularExpressions
            Dim objRegEx As System.Text.RegularExpressions.Regex
            Dim objMatch As System.Text.RegularExpressions.Match
            Dim strResult As String
            ' Create regular expression
            objRegEx = New System.Text.RegularExpressions.Regex( _
                  "a.*href\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))", _
                  System.Text.RegularExpressions.RegexOptions.IgnoreCase Or _
            ' Match expression to HTML
            objMatch = objRegEx.Match(HTML)

            While objMatch.Success
                  Dim strMatch As String
                  strMatch = objMatch.Groups(1).ToString
                  strResult &= strMatch & vbCrLf
                  objMatch = objMatch.NextMatch()
            End While
            ' Pass back results
            Return strResult
  End Function
Avatar of Fernando Soto
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answers