ASP.NET (C#) HTML match help

Discussion in 'Programming' started by zolpeti, Dec 8, 2009.

  1. #1
    Using C# I want to extract some data from an HTML code between specified TAGs
    For example i want to save the next data into an array
    <td class="cote1">4.2062</td>
    <td class="cote2">5.345</td>
    a[1]="4.2062" , a[2]="5.345"

    I've written some functions that save the content of the specified file, but I don't know how to continue.


    const string HTML_TAG_PATTERN = "<div class=\"fcstSmTextBox\">([^(<>)]*)</div>";
    public string StripHTML(string inputString)
    {
    return Regex.Replace
    (inputString, HTML_TAG_PATTERN, string.Empty);
    }

    protected void Page_Load(object sender, EventArgs e)
    {
    String htmlText = file_get_contents("http://www.paginaweb.com");
    slideshow.InnerText = StripHTML(htmlText);
    }
     
    zolpeti, Dec 8, 2009 IP