I need to find matching string that takes minimum length, but my code shows exactly opposite, how can I fixed it?
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();