Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- namespace _02MatchPhoneNumbers
- {
- class MatchPhoneNumbers
- {
- static void Main()
- {
- var input = Console.ReadLine();
- var pattern = @"^\+359(-| )\d\1\d{3}\1\d{4}$";
- var regex = new Regex(pattern);
- while (input != "end")
- {
- var match = regex.Match(input);
- if (match.Success)
- {
- Console.WriteLine(match.Value);
- }
- input = Console.ReadLine();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment