日期:2014-05-17 浏览次数:20546 次
string source = "[/表情1]jdf[/表情2][/表情34]jdflksjflsjlsjf"; Regex reg = new Regex(@"(?is)(/表情)(\d+)(])"); source = reg.Replace(source, "<img src=face/$2.gif>");
------解决方案--------------------
string test = "[/表情1]jdf[/表情2][/表情34]jdflksjflsjlsjf"; test = Regex.Replace(test, @"\[/\D+(\d+)\]", "<img src=face/$1.gif>"); //<img src=face/1.gif>jdf<img src=face/2.gif><img src=face/34.gif>jdflksjflsjlsjf