本帖最后由 willweiwei 于 2011-11-13 20:55:24 编辑

解决方案 »

  1.   

    你的规则不是很明确  不好写
    Try:[A-Za-z]:\\[^.]+(\.\S+)?
      

  2.   

    既然来了CSDN 不看看过客的正则blog就太可惜了http://blog.csdn.net/lxcnn
      

  3.   

    http://deerchao.net/tutorials/regex/regex.htm
      

  4.   

    这个试试: string s = @"啊sdk哈a说的CWAD:\win我的\wdnin EN额的\weni的 的想W.exe -dea阿萨德 /f /f到我弄哦那我的按时dsdfsadasdasda打算打算萨顶顶E:\winds\rundll.dll C:\wdwom.dll aw3deasd大三的C:\windows\sy ssds\的";
    MatchCollection matches = Regex.Matches(s + " ", @"(?is)[a-z]:\\(?:[^:\\]+\\)*(?:[^:\\]+\.[a-z\d]*)?(?=.*?\s+)");
    foreach (Match match in matches)
    Response.Write(match.Value + "<br/>");
    输出:
    D:\win我的\wdnin EN额的\weni的 的想W.exe
    E:\winds\rundll.dll
    C:\wdwom.dll
    C:\windows\sy ssds\不一定通用,你可以参考一下。
      

  5.   

     string tempStr = File.ReadAllText(@"C:\Users\dell\Desktop\Test.txt", Encoding.GetEncoding("gb2312"));
                string pattern = @"(?im)[A-Z]:((\\)?[^\\:]+\\)*((\\)?[^.]+\.[^\s]+)?";
                foreach (Match m in Regex.Matches(tempStr, pattern))
                {
                    string value = m.Value;
                }
                /*结果输出:
                  D:\win我的\wdnin EN额的\weni的 的想W.exe
                  E:\winds\rundll.dll
                  C:\wdwom.dll
                  C:\windows\sy ssds\
                 */