利用正规表达式,读取Discuz帖子中的附件,思路如下:

var rg = new Regex(@"(?<=\[attach\]).*?(?=\[/attach\])");
var mMatchCollection = rg.Matches(mContent);
for (var j = 0; j < mMatchCollection.Count; j++)
{  

  var sSql = "select attachment from cdb_attachments where aid="+mMatchCollection[j].Value;

}

posted on 2013-03-21 18:22  晓晨  阅读(754)  评论(0编辑  收藏  举报