fork(4) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. namespace RegExApplication
  5. {
  6. public class Program
  7. {
  8. public static void Main(string[] args)
  9. {
  10. string input = "x-[ABCD]";
  11. string pattern = "^x-\\[(.*)\\]$";
  12. Regex rgx = new Regex(pattern);
  13.  
  14. Match match = rgx.Match(input);
  15.  
  16. if (match.Success)
  17. {
  18. Console.WriteLine(match.Groups[1].Value);
  19. }
  20. }
  21. }
  22. }
Success #stdin #stdout 0.1s 24968KB
stdin
Standard input is empty
stdout
ABCD