using System; using System.Text.RegularExpressions; namespace RegExApplication { public class Program { public static void Main(string[] args) { string input = "x-[ABCD]"; string pattern = "^x-\\[(.*)\\]$"; Regex rgx = new Regex(pattern); Match match = rgx.Match(input); if (match.Success) { Console.WriteLine(match.Groups[1].Value); } } } }