Regex reg = new Regex("",RegexOptions.IgnoreCase|RegexOptions.Multiline);
MatchCollection Allmatch = reg.Matches(a);
GroupCollection group;
string temp = "";
foreach(Match amatch in Allmatch)
{
group = amatch.Groups;         temp = group[""].Value;         ...}
主要是<#..#>也有尖括号,不能用<#(<INF>)#>

解决方案 »

  1.   

    非的用正则表达式吗?
    你用循环不可以取出来吗?
    string str = "<#aaaaaa#><#bbbbb#><#ccccccccccc#>"; ArrayList arr = new ArrayList();
    while(str.Trim().IndexOf("<#") != -1)
    {
    int start = str.IndexOf("<#")+2;
    int end = str.IndexOf("#>");
    arr.Add(str.Substring(start,end-start));
    str = str.Substring(end+2);
    } for(int i=0;i<arr.Count;i++)
    {
    Response.Write(arr[i].ToString());
    }
      

  2.   

    xiaohutushen(xiaohutushen) ,谢谢你的回复,
    不过我也想知道这种情况下正则表达式怎么写
      

  3.   

    mobydick(敌伯威)  ,你的正则表达式好用,不过我刚学,看不太懂,不知道组名在哪里写,或者告诉我怎么把匹配项放到string 变量里
      

  4.   

    mobydick(敌伯威) 
    <\#([^<>#]+)\#>
    ---------------
    我不太明白你第三个#是什么意思?