How to get only one information from this table? VB.NET

0

Hello, I have this table, which has no class, id, or name. I would like to take only her phone.

How would you get it?

<tr>
                    <td><a href="http://www.google.com/">1</a></td>
                    <td><a href="http://www.google.com/"></a></td>
                    <td><a href="http://www.google.com/">name</a></td>
                    <td><a href="http://www.google.com/">99 999999999</a></td>
                    <td><a href="http://www.google.com/">[email protected]</a></td>
                </tr>
    
asked by anonymous 18.03.2017 / 19:24

2 answers

2

Maybe, it's something like:

Dim TDUM As String
Dim TDDOIS As String
Dim TDTRES As String
Dim TDQUATRO As String
Dim count As Integer = 0

Dim substrings() As String = Regex.Split(codigo.text, "<a[^<>]*>")
    For Each match As String In substrings
                Dim aryTextFile = match.Split("</a>")
                If count = 2 Then
                    TDUM = aryTextFile(0)
                ElseIf count = 3 Then
                    TDDOIS = aryTextFile(0)
                ElseIf count = 4 Then
                    TDTRES = aryTextFile(0)
                ElseIf count = 5 Then
                    TDQUATRO = aryTextFile(0)
                End If
                count += 1
            Next

count = 0

It would be more or less that, I'm studying, so there are certainly smaller codes out there, but I was able to get to this code at the moment.

For people who understand, I'm sorry for the big messy code (:

    
19.03.2017 / 17:59
0

It's not a good idea to have an element with no identifiers, but assuming this is the best case .. (only table in the DOM, always with this amount of columns), you can use jQuery:

$('table').find ('td').eq(3);
    
19.03.2017 / 15:57