.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Need help with regmatch

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :.NET Framework

Hi guys,

I need your help. I have created regmatch method to attempt to get the text from the html tags, but it will only get the full html tags from the page.


Here's the code:


 Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  'Address of URL
  Dim URL As String = "http://www.mysite.com/"
  Dim request As HttpWebRequest = CType(WebRequest.Create(URL), HttpWebRequest)
  Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
  Dim reader As StreamReader = New StreamReader(response.GetResponseStream())
  Dim str As String = reader.ReadToEnd()
  Dim regexMatch As System.Text.RegularExpressions.Match = System.Text.RegularExpressions.Regex.Match(str, "<p id='myid'></p>.*<p id='myid'></p>", System.Text.RegularExpressions.RegexOptions.IgnoreCase)

  Dim m As Match = Regex.Match(str, "<p id='myid'>\s*(.+?)\s*</p>", RegexOptions.Multiline)
  While (m.Success)
   m = m.NextMatch()
  End While
 End Sub



Here's the html tags that have been showing out on my listview:








View Complete Post

More Related Resource Links

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend