Hope it helps to solve your problem,
class Program
{
static void Main(string[] args)
{
string myWord = "This a sample text 4 that contains 9 words ";
string[] numbers = Regex.Split(myWord, @"\D+");
int parsedValue = 0;
int result = numbers.SkipWhile(item => string.IsNullOrEmpty(item)).Sum(item => Int32.TryParse(item, out parsedValue) ? parsedValue : parsedValue);
}
}
:)