deliberate lies - interactive DHTML

deliberate lies

Defiant, stony, deliberate, their lies will not get in my way.

如何多次提取字符串中的指定字符串

例如:从数据中获取content字符串,这个content用于前台html的显示,content中包含多个<img src="_IIMMGG_2156537">,_IIMMGG_后面的数字是imageid,每个img标签的id各不相同,如何获取content中各_IIMMGG_后面的imageid呢?

--解决方案

string tmp = this.m_PropContent;
Regex RX = new Regex(@"_IIMMGG_\-?\d+", RegexOptions.Compiled);
MatchCollection match = RX.Matches(tmp,0);
string imageId = "";

foreach(Match ma in match)
{
string strValue= ma.Value;
string strId = strValue.Replace("_IIMMGG_","");
imageId+= strId+",";
}

 

posted on 2017-01-10 16:48  悲淚滿衣襟  阅读(554)  评论(0)    收藏  举报

导航