<img alt="" src="http://www.xxx.com/Jobs/D2i0V" mce_src="http://www.xxx.com/Jobs/D2i0V" /> 
<img alt="" src="http://www.xxx.com/Jobs/D2123" mce_src="http://www.xxx.com/Jobs/D2123" /> 要将上面的图片换替成文字, 
比如说, 
根据 http://www.xxx.com/Jobs/D2i0V 的 D2i0V 对应的字符是 A 
根据 http://www.xxx.com/Jobs/D2123 的 D2123 对应的字符是 B. 要实现一个方法就是,就是在输入对应的编号,就将图片替换成文字。如,returnstr("D2i0V","A") 返回一个A public string returnstr(string code,string str) 

    (code) 
    return str. 
} 面里的正则怎样写啊? 注意是将 <img alt="" src="http://www.xxx.com/Jobs/D2i0V" mce_src="http://www.xxx.com/Jobs/D2i0V" />类似 替换成一个字符.以下是刚发不久的贴子,都不合适http://topic.csdn.net/u/20091201/12/16680b8b-eb76-4af5-99d2-ba6b76cd2d21.html?seed=1933440716&r=61565414#r_61565414

解决方案 »

  1.   

    你哪个网址对应A,哪个网址对应B的规则在哪里?还是只是从A一直往下数?
      

  2.   

    to 波导终结者 
    比如字符串如下: 1 <img alt="" src="http://www.xxx.com/Jobs/D2i0V" mce_src="http://www.xxx.com/Jobs/D2i0V" /> 
    <img alt="" src="http://www.xxx.com/Jobs/D2123" mce_src="http://www.xxx.com/Jobs/D2123" /> 2 那替换后的结果就是:1AB2
      

  3.   

      public static string returnstr(string content,string code, string str)
            {
                string pattern = string.Format("<img(\\s|.)*src=[^\\s](.*){0}[^\\s][^>]*>", code);
                content = Regex.Replace(content, pattern, str, RegexOptions.IgnoreCase);
                return content;
            }