VB.NET REGEX

I must to parse nick name From A webForm.
The Nicname Code is
<a href="member.php?u=95819">!!!SpartakFan!!!</a>

Open in new window

or
<a href="member.php?u=21040">!!DITH!!</a>

Open in new window

I Need TO get Only the value between ">  </a>
If it possible to do with httpwebrequest,please write me the code,if not,write it with using of webbrowser.
Thank YOU.
Replica178Asked:
Who is Participating?
 
Fernando SotoConnect With a Mentor RetiredCommented:
Hi Replica178;

This code snippet should do what you need.

' The inoput data / Web Page
Dim input As String = "I Need TO get Only the value between ""> </a>If it possible to do with httpwebrequest,please <a href=""member.php?u=95819"">!!!SpartakFan!!!</a> write me the code,if not,write it with using of webbrowser.Thank YOU. "
' The Regex pattern
Dim pattern As String = "<a href=\x22member.php[^>]+>(?<Nickname>[^<]+)"
' Find all the matches
Dim matches As MatchCollection = Regex.Matches(input, pattern)

' Check to see if any matches were found
If matches.Count > 0 Then
    ' Get the Nickname's
    For Each m As Match in matches
        Console.WriteLine("Nickname = " & m.Groups("Nickname").Value)
    Next
End If

Open in new window


Fernando
0
 
Replica178Author Commented:
ok.Thank you very much
0
 
Replica178Author Commented:
Thanks
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Fernando SotoRetiredCommented:
Not a problem; glad to help out.  ;=)
0
 
Replica178Author Commented:
Dim input As String = "I Need TO get Only the value between ""> </a>If it possible to do with httpwebrequest,please <a href=""member.php?u=95819"">!!!SpartakFan!!!</a> write me the code,if not,write it with using of webbrowser.Thank YOU. " 

Open in new window

what i must write here?
0
 
Fernando SotoRetiredCommented:
Hi Replica178;

That is the string of data that you wish to find the nickname in. In your question you stated this, "I must to parse nick name From A webForm.", I do not know how you are getting the information so I just used a simple string to show how it works. the input variable could be the result of a web request.

Fernando
0
All Courses

From novice to tech pro — start learning today.