// Test RegEx
String content = "";
String outhtml = "";
RegEx;
Match MC;
Streamreader sr = new streamreader ("C: // a.txt", system. Text. encoding. getencoding ("gb2312 "));
Content = Sr. readtoend ();
Content = content. Replace ("/"","'");
// Start to use the regular expression to retrieve the image file name
// RegEx = new RegEx ("class =/" text02/"> (? <Cityname>. *) </div> ");
RegEx = new RegEx (@ "(/S *) <TD width = '000000' bgcolor = 'f6f6f6 'class = 'text02'> (/S *)(? <Cityname>. *) (/S *) </TD> (/S *) <TD width = '55' align = 'center' bgcolor = 'f6f6f6 '> (/S *) (? <Weather>. *) (/S *) </TD> ", regexoptions. Compiled );
Outhtml + = "<Table widht = 100% border = 1 bgcolor = d7d7d7> ";
Outhtml + = "<tr> <TD colspan = 10> test </TD> </tr> ";
For (MC = RegEx. Match (content); Mc. success; MC = mc. nextmatch ())
{
Outhtml + = "<tr> <TD> City: </TD> <TD>" + MC. groups ["cityname"]. value + "</TD> <TD>" + MC. groups ["Weather"]. value + "</D> </tr> ";
}
Outhtml + = "</table> ";
Response. Write (outhtml );
*******************************
One of the key points is:
<Tr> <TD> must be expressed by (/S *). This indicates an infinite number of spaces. Otherwise, cool