Results 1 to 2 of 2

Thread: Regular expressions?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    66

    Regular expressions?

    Hey,

    how could i parse jsut a line out of the HTML of a web page...so for example out of the source i ony wanted this line

    Quote Originally Posted by The line i want
    <b>PLAYERS:<b><br><font color="#ea0437"><b>I Want THis</b></font><br><font color="#ea0437"><b>I Want THis</b></font><br><br><font color="#1796cb"><b>I Want THis</b></font><br><font color="#1796cb"><b>SI Want THis</b></font><br><font color="#1796cb"><b>I Want THis</b></font><br><br></b></b>
    And then from there i want to parse futhure...how would i parse out all the I want this's? Thanks

    -T

  2. #2
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Regular expressions?

    Code:
    			string Input = "<b>PLAYERS:<b><br><font color=\"#ea0437\"><b>I Want THis</b></font><br><font color=\"#ea0437\"><b>I Want THis</b></font><br><br><font color=\"#1796cb\"><b>I Want THis</b></font><br><font color=\"#1796cb\"><b>SI Want THis</b></font><br><font color=\"#1796cb\"><b>I Want THis</b></font><br><br></b></b>";
    			foreach(Match mt in Regex.Matches(Input,"(?<=<font color.+?><b>).+?(?=</b>)"))
    			{
    				Console.WriteLine(mt.Value);
    			}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width