optybg

Untitled

Jun 13th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4.  
  5. namespace _02MatchPhoneNumbers
  6. {
  7. class MatchPhoneNumbers
  8. {
  9. static void Main()
  10. {
  11. var input = Console.ReadLine();
  12.  
  13. var pattern = @"^\+359(-| )\d\1\d{3}\1\d{4}$";
  14. var regex = new Regex(pattern);
  15.  
  16. while (input != "end")
  17. {
  18.  
  19. var match = regex.Match(input);
  20.  
  21. if (match.Success)
  22. {
  23. Console.WriteLine(match.Value);
  24. }
  25.  
  26. input = Console.ReadLine();
  27. }
  28.  
  29. }
  30. }
  31. }
Add Comment
Please, Sign In to add comment