Hey guys tried a few things but Im clueless to stuff like regex and I really need this compontent to my project
:(

THIS NEEDS TO BE EXTRACTED - this changes on each refresh
I need that part of the data to be added to a list view

Please help me daniweb!!
Here is the code..

-----------------------------

<div class="span10" style="margin-bottom: 20px; box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.1);">
                <div class="file-head" style="padding: 10px;">
                    <h3 style="text-align: left; font-weight: 700; margin: 0;">Random data here..</h1>
                </div>
                    <div class="file-body" style="clear: both; text-align: left;">
                        <h4><b>File Name:</b> THIS NEEDS TO BE EXTRACTED </h4>
                        <h4><b>File ID:</b> 279</h4>
                        <h4><b>Size:</b> 2.35mb</h4>
                        <center><a class="btn btn-large btn-info" data-toggle="modal" href="#myModal">Download Your File</a></center>
                    </div>
                </div>
            </div>
        </div>
    </div>

Recommended Answers

All 2 Replies

Imports System.Text.RegularExpressions

Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        Dim text As String = System.IO.File.ReadAllText("d:\temp\test.html")

        Dim pattern1 As String = "<h4><b>File Name:</b>(.*)</h4>"
        Dim m As Match = Regex.Match(text, pattern1)

        If m.Success Then
            MsgBox(m.Groups(1).Value)
        End If

    End Sub

End Class

The regular expression, pattern1 will match the required line. Note that part of the pattern consists of "(.*)". This is defined as a sub-pattern. The Match object, m, will contain two groups. The value of group one is the entire matched string. The value of group 2 will be the value of the sub-pattern, or the string you want to extract.

Worked a charm thank you very much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.