类似这样的一段html模板文本<!--#include file="top.html" -->
<tr>
    <td width="251" align="center" valign="top"><!--#include file="proleft.html" -->
    <img src="images/about6.jpg" width="231" height="61"></td>
    <td valign="top"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
<!--#include file="down.html" -->
 string pattern = "<!--#include file=\"([^\\]]*?)\" -->";
 foreach (Match m in Regex.Matches(GetHtml.ToString(), pattern, RegexOptions.IgnoreCase))
 {
                                
 }我应该怎样写才得取得所有包含文件的文件名?就是想得到top.html,proleft.html,down.html这些

解决方案 »

  1.   

       string strHTML = @"<!--#include file=""top.html"" -->
    <tr>
    <td width=""251"" align=""center"" valign=""top""><!--#include file=""proleft.html"" -->
    <img src=""images/about6.jpg"" width=""231"" height=""61""></td>
    <td valign=""top""><table width=""95%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">
    <tr>
    <!--#include file=""down.html"" -->";
    string pattern = @"<!--\s*#include file=""([^""]*?)""[^>]*?-->";
    MatchCollection mc = Regex.Matches(strHTML, pattern);
    foreach (Match m in mc)
    {
        Response.Write(m.Result("$1") + "<BR>");
    }