using System; using System.Linq; using System.Text.RegularExpressions; public class Test { public static void Main() { string sample = " class0 .calss1 .class2 .class3.class4 .class5 class6 .class7"; Regex regex = new Regex(@"\.[^ .]+"); var matches = regex.Matches(sample); string[] result = matches.Cast().Select(x => x.Value).ToArray(); foreach (string word in result) { Console.WriteLine(word); } } }