不用正则string test = "www.163.com/a/b.aspx";
string[] result = test.Split(new char[] { '.', '/' });
foreach (string s in result)
{
    Response.Write(s + "<br>");
}

解决方案 »

  1.   


    string str = "www.163.com/a/b.aspx";
    string pt = @"[a-zA-Z0-9]+";
    System.Text.RegularExpressions.MatchCollection mc = System.Text.RegularExpressions.Regex.Matches(str, pt);
    for(int i = 0; i < mc.Count; i++) {
    for(int j = 0; j < mc[i].Captures.Count; j++) {
    Response.Write(mc[i].Captures[j].ToString() + "&nbsp;&nbsp;&nbsp;");
    }
    }
      

  2.   

    汗,这还非得用正则的string test = "www.163.com/a/b.aspx";
    string[] result = Regex.Split(test, "[./]");
    foreach (string s in result)
    {
        Response.Write(s + "<br>");
    }