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