@"(?<=\{mylabel)(?<mylabel>[^{}]*)(?=\})",
string str="{mylabel type=\"title\"/}{mylabel type=\"articleList\" wordlength=\"30\" articleTypeId=\"20\"/}"; System.Text.RegularExpressions.Regex reg=new System.Text.RegularExpressions.Regex(@"\{mylabel\s+type=""(?<type>[^""\{\}]\w+)""(\s+wordlength=""(?<wordlength>[^""\{\}]\d+)""\s+articleTypeId=""(?<articleTypeId>[^""\{\}]\d+)"")?/\}",System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Text.RegularExpressions.MatchCollection m = reg.Matches(str); //设定要查找的字符串 for (int i = 0; i < m.Count; i++) { Response.Write(m[i].Groups["type"].ToString()+"<br>"); }