感谢您使用微软产品。请您参阅下面的代码:同时,请您注意在正则式中用\s来表达空格的时候,您需要双写反斜杠。同样,您用\S表达非空格时,也要双写。void DumpHrefs(String inputString) 
{     Regex r;
     Match m;     r = new Regex("href\\s*=\\s*(?:\"(?<1>[^\"]*)\"|(?<1>\\S+))",     RegexOptions.IgnoreCase|RegexOptions.Compiled);     for (m = r.Match(inputString); m.Success; m = m.NextMatch()) 
      {
         Console.WriteLine("Found href " + m.Groups[1] + " at "+ m.Groups[1].Index);
      }
}希望对您有所帮助。-微软全球技术中心  -zgh本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。