例如:从数据中获取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+","; }
时间: 2024-12-13 09:35:39