using System;using System.Text.RegularExpressions;class Program{ static void Main(string[] args) { string r = @"\b(\w|[-'])+\b"; string text = "This is a test"; Console.WriteLine (Regex.Matches (text, r).Count); }}The output:4