111,097
社区成员




Regex token = new Regex(@"(?<word>abc)", RegexOptions.Compiled);
MatchCollection matches = token.Matches("bcabcabcabcabcpp");
if (matches.Count != 0)
{
foreach (Match matchList in matches)
{
Console.WriteLine("word:{0}",matchList.Groups["word"]);
}
}
Console.ReadLine();
string str = "bcabcabcabcabcpp";
Console.WriteLine(Regex.Match(str, @"(?<!abc)(?<word>abc)").Groups["word"].Value);