例如。我有字符串
string text = @"Today is {Rand_num 15-22} day. {Rand_num 11-55} number of our trip.";
我需要用 rand 数替换每个 Rand_num 收缩(在规定的数字 15-22 或 11-55 之间)
尝试了但不知道下一步该怎么做
string text = @"Today is {Rand_num 15-22} day. {Rand_num 11-55} number of our trip.";
if (text.Contains("Rand_num"))
{
string groups1 = Regex.Match(text, @"{Rand_num (.+?)-(.+?)}").Groups[1].Value;
string groups2 = Regex.Match(text, @"{Rand_num (.+?)-(.+?)}").Groups[2].Value;
}