C# 文字列から数値だけを抜き出す

正規表現で数字だけ抜き出す。

using System.Text.RegularExpressions;

string str = Regex.Replace (gameObject.name, @"[^0-9]", "");
Debug.Log (str);