E:\OfficeChannel\OfficeChannel\CourseChannel\CourseUpdate\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\XML.zip原
 我想要CourseUpdate\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\XML.zip 怎么截取
 还有我想研究一下截取字符串和正则中的匹配朋友们给我点学习资源谢谢..

解决方案 »

  1.   

    正则资料:
    http://www.tracefact.net/document/Regular-Expression-Tutorial.pdf
      

  2.   

         string sss = @"E:\OfficeChannel\OfficeChannel\CourseChannel\CourseUpdate\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\XML.zip";
           respose.write(sss.Substring(sss.IndexOf("CourseChannel")));//这个就是你要的结果
      

  3.   

    什么规则?磁盘的第三层目录开始?
    string pattern=@"(?<=[a-zA-Z]:\\(?:[^\\]+\\){2})[\s\S]*?\.[0-9a-zA-Z]+";
      

  4.   

    string words="E:\OfficeChannel\OfficeChannel\CourseChannel\CourseUpdate\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\XML.zip";
     
    string[] split = words.Split(new Char[] { '\' });
    stringt new;
    for(int i=4;i<split.lenth;i++)
    {
    new+=split[i].tostring();
    }
      

  5.   

    更正一下
    string words="E:\OfficeChannel\OfficeChannel\CourseChannel\CourseUpdate\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\XML.zip"; string[] split = words.Split(new Char[] { '\' }); 
    string new; 
    for(int i=4;i <split.lenth;i++) 

    new+=split[i].ToString()+"\"; 
    }
    response.write(new);
      

  6.   


     string path = "E:\\OfficeChannel\\OfficeChannel\\CourseChannel\\CourseUpdate\\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\\XML.zip";
                path = path.Substring(2, path.Length - 2);
                string fin = string.Empty;
                string[] s = path.Split("\\".ToCharArray());
                for(int i=3;i<s.Length;i++)
                {
                    fin += s[i].ToString() + "\\";
                }
                fin = fin.Substring(0, fin.Length - 1);
                Response.Write(fin);
      

  7.   

    string[] split = words.Split(new Char[] { ',', '.' }, 2);//返回:{"1","2.3,,4"}
    string words="E:\OfficeChannel\OfficeChannel\CourseChannel\CourseUpdate\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\XML.zip"; string[] split = words.Split(new Char[] { '\' },4); 
     
    response.write(split[2].tostring());
      

  8.   


    string path = "E:\\OfficeChannel\\OfficeChannel\\CourseChannel\\CourseUpdate\\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\\XML.zip";
                string fin = string.Empty;
                string[] s = path.Split("\\".ToCharArray());
                for(int i=4;i<s.Length;i++)
                {
                    fin += s[i].ToString() + "\\";
                }
                fin = fin.Substring(0, fin.Length - 1);
                Response.Write(fin);