Advertisement
Guest User

Untitled

a guest
Oct 1st, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. <span id="point_total" class="tooltip" oldtitle="Note: If the number is black, your points are actually a little bit negative. Don't worry, this just means you need to start subbing again." aria-describedby="ui-tooltip-0">31</span>
  2.  
  3. <DIV id=point_display>You have<BR><SPAN id=point_total class=tooltip jQuery16207621750175125325="23" oldtitle="Note: If the number is black, your points are actually a little bit negative. Don't worry, this just means you need to start subbing again.">17</SPAN><BR>Points </DIV><IMG style="FLOAT: right" title="Gain subscribers" border=0 alt="When people subscribe to you, you lose a point" src="http://static.subxcess.com/images/page/decoration/remove-1-point.png"> </DIV>
  4.  
  5. var regex = new Regex(@"<span id=""point_total"" class=""tooltip"" oldtitle="".*?"" aria-describedby=""ui-tooltip-0"">(.*?)</span>");
  6.  
  7. var match = regex.Match(@"<span id=""point_total"" class=""tooltip"" oldtitle=""Note: If the number is black, your points are actually a little bit negative. Don't worry, this just means you need to start subbing again."" aria-describedby=""ui-tooltip-0"">31</span>");
  8.  
  9. var result = match.Groups[1].Value;
  10.  
  11. HtmlDocument doc = new HtmlDocument;
  12. doc.Load("filepath");
  13.  
  14. HtmlNode node = doc.DocumentNode.SelectSingleNode("//span"); //Here, you can also do something like (".//span[@id='point_total' class='tooltip' jQuery16207621750175125325='23' oldtitle='Note: If the number is black, your points are actually a little bit negative. Don't worry, this just means you need to start subbing again.']"); to select specific spans, etc...
  15.  
  16. string value = node.InnerText; //this string will contain the value of span, i.e. <span>***value***</span>
  17.  
  18. // <TAG(.*?)>(.*?)</TAG>
  19. // Example
  20. var regex = new System.Text.RegularExpressions.Regex("<h1(.*?)>(.*?)</h1>");
  21. var m = regex.Match("Hello <h1 style='color: red;'>World</h1> !!");
  22. Console.Write(m.Groups[2].Value); // will print -> World
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement