string a = "
a1 | a2 | a3 | a4 |
Regex reg1 = new Regex(@"]+>([^<>]+)]+>", RegexOptions.IgnoreCase);//此用于取一个时,不是集合时应用。
string str = reg1.Match(a).Groups[1].Value;
Regex reg12 = new Regex(@"
([^<>]+)", RegexOptions.IgnoreCase);string str1 = reg12.Match(a).Groups[1].Value;
MatchCollection match = Regex.Matches(a, @"
].*?>(?[^<>]+)", RegexOptions.Compiled);MatchCollection match2 = Regex.Matches(a, @"]+>(?[^<>]+)]+>", RegexOptions.Compiled); //Success
MatchCollection match3 = Regex.Matches(a, @"
(?[^<>]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);MatchCollection match4 = Regex.Matches(a, @"
]+>(?[^<>]+)", RegexOptions.Compiled);string a1 = "
hello | world |
MatchCollection match5 = Regex.Matches(a1, @"
(?[^<>]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);foreach (Match m in match5)
{
Response.Write(m.Groups["content"].Value + "
");
}