Find data in HTML file and display it in a textbox?
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
2 posts
Page 1 of 1
Hi
I have started working on a program which is kind of a bot thing. First it gets the source code from a HTML page and puts it all into a single string. This part is working.
Now in the source code there might contain a line which looks like this:
if('1' == '0' || 'abc' == '123')
123 is always the same and its not important but instead of 'abc' each page has a different string and this is the thing I want to be displayed in my textbox.
So basically I want the program to find a line starting with if('1' == '0' || and then read out the 'abc' value.
Hope you understand what I mean. Thanks cooll;
I have started working on a program which is kind of a bot thing. First it gets the source code from a HTML page and puts it all into a single string. This part is working.
Now in the source code there might contain a line which looks like this:
if('1' == '0' || 'abc' == '123')
123 is always the same and its not important but instead of 'abc' each page has a different string and this is the thing I want to be displayed in my textbox.
So basically I want the program to find a line starting with if('1' == '0' || and then read out the 'abc' value.
Hope you understand what I mean. Thanks cooll;
This is a signature.
You could use a regular expression, I'm not good with those but here's one generated from txt2re.com
Code: Select all
Works fine cooll; Dim txt As String = "if('1' == '0' || 'GET THIS' == '123')"
Dim re1 As String = ".*?" 'Non-greedy match on filler
Dim re2 As String = "\'.*?\'" 'Uninteresting: strng
Dim re3 As String = ".*?" 'Non-greedy match on filler
Dim re4 As String = "\'.*?\'" 'Uninteresting: strng
Dim re5 As String = ".*?" 'Non-greedy match on filler
Dim re6 As String = "(\'.*?\')" 'Single Quote String 1
Dim r As Regex = New Regex(re1 + re2 + re3 + re4 + re5 + re6, RegexOptions.IgnoreCase Or RegexOptions.Singleline)
Dim m As Match = r.Match(txt)
If (m.Success) Then
Dim strng1 = m.Groups(1)
MsgBox(strng1.ToString().Replace("'", ""))
End If
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
2 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023