using System; using System.Text; using System.Text.RegularExpressions; using System.IO; public class Test { public static void Main() { var s = "2.2|[johnnyappleseed@example.com]"; var rx = new Regex(@"(?<=\[)[^]]+"); Console.WriteLine(rx.Match(s).Value); var ss = s.Split('|'); if (ss.GetLength(0) > 1) { var last = ss[ss.GetLength(0)-1]; if (last.Contains("[") && last.Contains("@")) // We assume there is an email Console.WriteLine(last.Trim(new[] {'[', ']'})); } } }