以下代码,使用正则表达式,读取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;
}