Hi, In my program it gets the webpages html. I now need to get certain information from it. i need all the words between "> and </a>. You see it goes in a pattern. theres like 100 names on each webpage. I need the words in red. The variable that has the webpages inofrmation is sdata can anyone help me? I think i need to use a regualr expression but which one and how? Thanks
Its not working for me. But let me give you somemore details. The webpage that i need the information from is in the variable url . I need to take the information i got and put it in listbox1. In your code i dont understand where all the output goes. Is it in one of the variables?
i cant understand why it is not working. when i click the button nothing happens. Im sorry url is not text. It is the actuall link to the page. The text variable is sData but i dont know if i did it the right way. This is what i have:
VB Code:
stream = New IO.StreamReader(wc.OpenRead(url))
sData = stream.ReadToEnd
Dim pattern As String = "\>\w+\<\/a\>"
Dim reg As New System.Text.RegularExpressions.Regex(pattern)
Dim mcol As System.Text.regularexpressions.MatchCollection = reg.Matches(sData)
For Each m As System.Text.RegularExpressions.Match In mcol
ListBox1.Items.Add(m.Value)
Next
End Sub
By the way thank you for your help it is greatly apreciated because i have a deadline by tommorw at 5'o Clock
Last edited by VBGangsta; Sep 16th, 2003 at 08:16 PM.
What exaclty is a break point and where do i put?. Sry for all the questions. SData is the variable that holds the downloaded Html(in text form) That is what i posted.
Last edited by VBGangsta; Sep 16th, 2003 at 08:56 PM.
A breakpoint is a location that is set to have your code stop so you can debug. It looks like a red dot on the left margin by the code in the IDE. If sData contains the same text as you posted or text in the same format then it will work.
I have no idea why this isnt working. I was looking at the breakpoints but i really didnt see a porblem. But when i click the button to intiate those events nothing is displayed in the listbox. I checked your pattern and that is correct to find the names, well very close. so i dont know what to do. Can u help me? THanks you
OK i think I found thee problem. I set a breakpoints where SData(the variable holding the downloaded html text) was. At the bottom of my environment i saw and excel type window and i saw sdata then to the right i saw the html. So i right clicked the html text and copied and pasted it to a word documeant and saw that the html that it is holding is not all of it. its only the top part that doesnt even have the information i need so I am guessing thats why nothing is showing up in the listbox. Something must be wrong with the downloaded html text commands. Think you could help? Thanks
Well that doesn't help considering you said the problem was getting the page. Maybe the trouble is that when you try and retrieve the page it isn't logging you in. You should see if the html you are retrieveing has the sql error in it.
no, the reason that u could not see that link is because you need to be loged in to beable to view that page. For now I will skip that problem and move on to retriving the info i need form the url. Lets say that the html is in the sData variable. I have made a pattern or whatevr u call it, >(\S+)</a but i do not know how to go about doing this.
Well if you can get the data into sData from the URL then you are all set. Are you asking how to implement the code I gave you? If so here is an example that uses the text file you posted.