我需要找到匹配字符串中最短的那个,但是我的代码显示出了相反的结果,我该如何修复它?
string line = @"xxxxxxxxxxxx A(a,b) and A(a,b) > 0 xxxxxxxxx \n xxxxxxxxx A(a,b) and A(a,b) > 0 xxxxxxxxxxxxxxxxxx";
string Pattern = "A.+?>";
MatchCollection M1 = Regex.Matches(line, Pattern);
Console.WriteLine(M1[0].ToString()); //I want 【A(a,b) >】 but it shows 【A(a,b) and A(a,b) >】
Console.WriteLine(M1[1].ToString()); //I want 【A(a,b) >】 but it shows 【A(a,b) and A(a,b) >】
Console.Read();
.+
中排除字符串A(a,b)
。 - user202729A[^A]+?>
是什么? - splash58