[h-t]{4}://[d-t]{7}.[e-y]{5}.[c-o]{3}/[a-u]{9}/[\d]{8}/[\d]{8}.[g-p]{3}

解决方案 »

  1.   

    [h-t]{4}://[d-t]{7}.[e-y]{5}.[c-o]{3}/[a-u]{9}(/[\d]{8}){2}.[g-p]{3}
      

  2.   

    这个格式太固定了,主要是以http开头,以(jpg、png、gif、bmp)结尾,这个怎么样写呢
      

  3.   


    string pattern = @"http\S*(jpg|png|gif|bmp)";
                string result = Regex.Matches("22http://djpglhttpfbmpdd", pattern)[0].ToString();
      

  4.   


    string pattern = @"http\S*(jpg|png|gif|bmp)";
                string result = Regex.Matches("22http://djpglhttpfbmpdd", pattern)[0].ToString();必须是开头和结尾的话就加上\b和$,像这样
    string pattern = @"\bhttp\S*(jpg|png|gif|bmp)$";
                string target = "http://djpglhttpfbmpddfgif";
                string result;
                if (Regex.IsMatch(target, pattern))
                {
                    result = Regex.Matches(target, pattern)[0].ToString();
                }