using System; using System.Text.RegularExpressions; class Program { static void Main() { string input = "@[User::RootPath]+\"Dim_MyPackage10.dtsx\""; Match m = Regex.Match(input, @"\[[^[\]]*\]"); Console.WriteLine(m.Value); } }