各位高手帮帮我吧!谢谢!我想使用VS2005开发出利用正则表达式匹配HTML文件的标签的程序,我首先在CLR的windows窗体应用程序中新建了2个按钮,1个richtextbox,点第一个按钮目的是浏览并打开一个html文件,然后点第二个按钮目的是匹配html文件中的标签,并将找到的正确的成对的标签高亮显示,比如找到了<html></html>,就把这两个标签显示成红色,然后继续自动查找其他的比如<head></head>标签,都显示成红色,别的都已经实现了,就是利用正则表达式匹配并高亮显示实现不了,大家能不能帮我想想应该怎么写代码呀?我现在把第二个按钮的代码附带如下:if(this->openFileDialog1->ShowDialog()==System::Windows::Forms::DialogResult::OK)
                 {
                     String^ MyFileName=this->openFileDialog1->FileName;
                     this->richTextBox1->LoadFile(MyFileName,RichTextBoxStreamType::PlainText);
                     String^ number = this->richTextBox1->Text;
                     String^ text=this->richTextBox1->Text;
String^ pat = "<(?<tag> \\w*)>([\\s\\S]*)</\\k<tag>>";
Regex^ r = gcnew Regex( pat,RegexOptions::IgnoreCase );
Match^ m = r->Match(text);
MatchCollection^ matches = r->Matches( text );
int count=matches->Count;
String^ sub;
while ( count--)
{
  int len=number->IndexOf(">")+1;
  int total=number->Length-len*2-1;
  sub=number->Substring(len,total);
  m = r->Match(text);
}
  this->richTextBox3->Text=sub;
                 }
             }