【发布时间】:2011-03-15 20:16:57
【问题描述】:
为什么会出现以下代码:
“the”有 1 个匹配项
而不是:
“the”有 3 个匹配项
using System;
using System.Text.RegularExpressions;
namespace TestRegex82723223
{
class Program
{
static void Main(string[] args)
{
string text = "C# is the best language there is in the world.";
string search = "the";
Match match = Regex.Match(text, search);
Console.WriteLine("there was {0} matches for '{1}'", match.Groups.Count, match.Value);
Console.ReadLine();
}
}
}
【问题讨论】: