For example, I have a string
string text = @"Today is {Rand_num 15-22} day. {Rand_num 11-55} number of our trip.";
I need to replace each Rand_num constraction with a rand number (between declared numbers 15-22 or 11-55)
I tried, but I do not know what to do next
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; }
obdgy source share