Hack Forums
[.NET] How to check a raw online text for a specific text - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] How to check a raw online text for a specific text (/showthread.php?tid=5867781)



How to check a raw online text for a specific text - Sulium - Jul 29, 2018

Ok so basically what I am wanting to do is type something in a textbox for example "Dogs" and search a raw online text file for the textbox's text. Then if the textbox's text is in the online text file then it would return all the text following that line in a label like this.

ONLINE TEXT FILE:
Dogs:German Sheperd:Really Cool:Nice
Bag:ffdf:fdfd:fdfd

So the label would return Dogs:German Sheperd:Really Cool:Nice

If you can help I would really appreciate it. I have been trying to figure this out for forever.


RE: How to check a raw online text for a specific text - SpookedOnion - Jul 29, 2018

Here is some shit I slapped together
Textbox1 is the URL
Textbox2 is the word or phrase your scanning for
Textbox3 is the output
Code
Imports System
Imports System.IO
Imports System.Text
Imports System.Net


Public Class Form1
    Dim url As String
    Dim webc As WebClient = New WebClient

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        url = TextBox1.Text
        If url <> "" Then
            Dim streamr As StreamReader = New StreamReader(webc.OpenRead(url))
            TextBox3.Text = streamr.ReadToEnd
            TextBox3.Text.Replace(":", " ")
            If TextBox3.Text.ToLower.Contains(TextBox2.Text.ToLower) Then
                Dim builder As New StringBuilder()
                For Each line As String In TextBox3.Text.Split(New String() {Environment.NewLine}, StringSplitOptions.None)
                    If line.ToLower().Contains(TextBox2.Text.ToLower) Or line.ToLower().Contains(TextBox2.Text) Then
                        builder.AppendLine(line)
                    End If
                Next
                TextBox3.Text = builder.ToString()
            Else
                TextBox3.Text = ""
            End If
        Else
            MsgBox("Enter a URL!")
        End If
    End Sub
End Class
/edit Fixed it so it's not case sensitive.