111,092
社区成员




public void Tag_ImgList()
{
string html = this.GetText();
StringBuilder sb = new StringBuilder();
string reg = "{fortyps:imglist(\\s+)(?<attr>[\\s\\S]*)}(?<content>[\\s\\S]*){/fortyps:imglist}";
MatchCollection matches = Regex.Matches(html, reg);
foreach (Match match in matches)
{
GroupCollection groups = match.Groups;
string attr = groups["attr"].Value;
string content = groups["content"].Value;
string value = match.Value;
string typeid = fortyps.util.Text.getAttributeValue(attr, "typeid");
string total = fortyps.util.Text.getAttributeValue(attr, "total");
this.elements.Add("a", typeid);
this.elements.Add("b", total);
}
}
public static string getAttributeValue(string s, string name)
{
string reg = name + "=\"(?<val>.*?)\"";
MatchCollection matches = Regex.Matches(s, reg, RegexOptions.IgnoreCase | RegexOptions.Compiled);
foreach (Match match in matches)
{
return match.Groups["val"].Value;
}
return string.Empty;
}
{fortyps:imglist typeid="4" total="11"}
fsadfdsfdsf
{/fortyps:imglist}
{fortyps:imglist typeid="4" total="11"}
fsadfdsfdsf
{/fortyps:imglist}
{fortyps:imglist typeid="4" total="11"}
fsadfdsfdsf
{/fortyps:imglist}
{fortyps:imglist typeid="2" total="11"}
fsadfdsfdsf
{/fortyps:imglist}
{fortyps:imglist typeid="1" total="11"}
fsadfdsfdsf
{/fortyps:imglist}
{fortyps:imglist typeid="3" total="11"}
fsadfdsfdsf
{/fortyps:imglist}