Поскольку вы специально упомянули C #, вот как я делаю этот точный анализ:
private static readonly Regex RgbValuePattern = new Regex(@"(?<r>\d{1,3}) ?, ?(?<g>\d{1,3}) ?, ?(?<b>\d{1,3})",
RegexOptions.Compiled | RegexOptions.ExplicitCapture);
Потом позже ...
var match = RgbValuePattern.Match(value);
if (match.Success)
{
int r = Int32.Parse(match.Groups["r"].Value, NumberFormatInfo.InvariantInfo);
int g = Int32.Parse(match.Groups["g"].Value, NumberFormatInfo.InvariantInfo);
int b = Int32.Parse(match.Groups["b"].Value, NumberFormatInfo.InvariantInfo);
return Color.FromArgb(r, g, b);
}