fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string s1 = "\"\"Being Ordered Around by You Makes Me Really Angry Somehow!!!\" \"Whaddaya Mean, 'Somehow'!!?\"",
  9. s2 = "\"\"Omae ni Meirei Sareru no wa Nanka Haratatsu!!!\" \"Nankatte Nani!!?\"\"";
  10.  
  11. Console.WriteLine("Before 1 : " + s1);
  12. Console.WriteLine("Before 2 : " + s2);
  13.  
  14. Regex r = new Regex("(\"[^\"]*\")[^\"]*(\"[^\"]*\")");
  15. Match m = r.Match(s1);
  16. Console.WriteLine("After 1.1 : " + m.Groups[1].Value);
  17. Console.WriteLine("After 1.2 : " + m.Groups[2].Value);
  18.  
  19. m = r.Match(s2);
  20. Console.WriteLine("After 2.1 : " + m.Groups[1].Value);
  21. Console.WriteLine("After 2.2 : " + m.Groups[2].Value);
  22. }
  23. }
Success #stdin #stdout 0.11s 25072KB
stdin
Standard input is empty
stdout
Before 1  : ""Being Ordered Around by You Makes Me Really Angry Somehow!!!" "Whaddaya Mean, 'Somehow'!!?"
Before 2  : ""Omae ni Meirei Sareru no wa Nanka Haratatsu!!!" "Nankatte Nani!!?""
After 1.1 : ""
After 1.2 : " "
After 2.1 : ""
After 2.2 : " "