fork(2) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text.RegularExpressions;
  6.  
  7. public class Test
  8. {
  9. public static void Main()
  10. {
  11. var text = "(String1) | (string2 string3)";
  12. var result = Regex.Match(text, @"\|\s*\(([^()]*)\)")?.Groups[1].Value;
  13. Console.WriteLine(result);
  14.  
  15. var result2 = text.Split(new[] {" | "}, StringSplitOptions.None)[1].Trim(new[] {'(', ')'});
  16. Console.WriteLine(result2);
  17. }
  18. }
Success #stdin #stdout 0.08s 31516KB
stdin
Standard input is empty
stdout
string2 string3
string2 string3