using System; using System.Collections.Generic; public class Test { public static void Main() { string str = @"stackoverflow(stack:stackoverflow)overstackflow(over:stackoverflow)"; IList foundStrings = new List(); int currentIndex = 0; int index = str.IndexOf("(", currentIndex); while (index != -1) { int start = index + "(".Length; int colonIndex = str.IndexOf(":", start); if (colonIndex != -1) { string nextFound = str.Substring(start, colonIndex - start); foundStrings.Add(nextFound); } currentIndex = start; index = str.IndexOf("(", currentIndex); } foreach(string found in foundStrings) Console.WriteLine(found); } }