When using string.Format(string, object[]) it throws an exception if string contains more format specifiers ({0}, {1:dd-MM-yyyy} etc.) than object[].Length.
I'd like to also throw an exception if object[].Length contains more specifiers. There seems to be no built-in way to do it, so I'm trying to get the number of format specifiers in the input string. The tricky bit is that stuff like {{something}} or {0:dd-MM-yyyy} is allowed.
Does anyone know an easy or even built-in way to get the number of format specifiers in a string? I'm currently trying to build a regex, but maybe there is an easier way?