string text = @"abc";
Regex r = new Regex(@".*?");
Console.WriteLine("r match count:" + r.Matches(text).Count);
...全文
3368135打赏收藏
【C#】容易而又不简单的正则表达式,高手请进!
用正则表达式".*?"来匹配文本"abc",能正确匹配几次?分别匹配成功的是什么?请给出解释? 代码如下,大家可以试试,我希望得到的是理论上的答案。 string text = @"abc"; Regex r = new Regex(@".*?"); Console.WriteLine("r match count:" + r.Matches(text).Count);