text replace

TMTakas

Member
Joined
Feb 6, 2013
Messages
15
Programming Experience
Beginner
Hi vbdotnetforums

i want to replace a text but is not working , what i want to do is to replace all the tet between <head> and </head> ,
i tried this code :

VB.NET:
Public Class Form12
    Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click

        Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://xxx.org/xxx/xxx.html")
        Dim response As System.Net.HttpWebResponse = request.GetResponse()

        Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())

        Dim sourcecode As String = sr.ReadToEnd()

        Dim m As String = sourcecode
        Dim j As String = m.Replace("<head>*\d</head>", " ")
        TextBox1.Text = j

    End Sub
End Class

THX :D
 
Back
Top