日期:2014-05-18 浏览次数:20808 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string strSource = @"C:\sdsd\sdsds\aa\wssww\ww\ee\rrrss.jpg"; //这里放网页源代码
            strSource = Regex.Match(strSource, @"(\\[^\\]+){3}$",   //这里可以放正则
                RegexOptions.IgnoreCase | RegexOptions.RightToLeft).Groups[0].Value;
            Console.WriteLine(strSource);
            Console.ReadLine();
        }
    }
}