fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. class program
  5. {
  6. static void Main(string[] args)
  7. {
  8. string text = txt();
  9. string pattern = @"a.";
  10. Regex reg = new Regex(pattern);
  11. MatchCollection m = reg.Matches(text);
  12. show(reg,m);
  13. }
  14.  
  15. static void show(Regex reg, MatchCollection m)
  16. {
  17. string[] names = reg.GetGroupNames();
  18. foreach(Match match in m)
  19. {
  20. Console.WriteLine("value : {0}\n", match.Value);
  21. /*length : {1}\nindex : {2}\nsuccess : {3} ",match.Value,match.Length,match.Index,match.Success );*/
  22.  
  23. }
  24.  
  25. }
  26. static int finds(string text, string pattern)
  27. {
  28. return 0;
  29. }
  30.  
  31. static string txt()
  32. {
  33.  
  34. string text = "A string is an object of type String whose value is text. Internally, the text is stored as a sequential read-only collection of Char objects. There's no null-terminating character at the end of a C# string; therefore a C# string can contain any number of embedded null characters ('\0'). The Length property of a string represents the number of Char objects it contains, not the number of Unicode characters. To access the individual Unicode code points in a string, use the StringInfo object.";
  35. return text;
  36. }
  37. }
Success #stdin #stdout 0.06s 29524KB
stdin
Standard input is empty
stdout
value : an

value : al

value : al

value : as

value : a 

value : al

value : ad

value : ar

value : at

value : ar

value : ac

value : at

value : a 

value : a 

value : an

value : ai

value : an

value : ar

value : ac

value : a 

value : ar

value : ai

value : ar

value : ac

value : ac

value : al

value : a