Advertisement
svetlyoek

Untitled

Mar 19th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6.  
  7. namespace ConsoleApp213
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. string text = Console.ReadLine();
  15. string pattern = @"(\+359([ -])2(\2)(2{3})(\2)(2{4}))\b";
  16. MatchCollection matches = Regex.Matches(text, pattern);
  17. var phones = new List<string>();
  18. foreach(Match match in matches)
  19. {
  20. phones.Add(match.Value);
  21. }
  22. Console.Write(string.Join(", ",phones));
  23. Console.Write("\n");
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement