.NET Fiddle

CSharp · Console

/Program.cs

using System;
using System.Text.RegularExpressions;
					
public class Program
{
	public static void Main()
	{
       string tmp = "This a little test is a little test an example. a little test";
       int sum = Regex.Matches(tmp, "a little test").Count;
	   Console.WriteLine(sum);
	}
}
;