using System; using System.Text.RegularExpressions; using System.Linq; public class Test { public static void Main() { string pattern = @"(?<=^(?:[^$]*\$){0,3})[^$]*\$?|[^$](?=\$|$)"; string[] strings = { "Text1", "Text1$Text2$Text3", "Text1$Text2$Text3$Text4$Text5$Text6" }; Regex regex = new Regex(pattern); foreach (String s in strings) { Console.WriteLine(string.Join("", from Match match in regex.Matches(s) select match.Value)); } } }