Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Phone number regex validator
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here var regex = @"^(?<countryCode>[\+][1-9]{1}[0-9]{0,2}\s)?(?<areaCode>0?[1-9]\d{0,4})(?<number>\s[1-9][\d]{5,12})(?<extension>\sx\d{0,4})?$"; var phones = new [] { "02 5555555 x4545", "054 5575487", "02 5555555", "054 5575487", "+1 212 7777777", "212 7777777", "+44 7777 777-777", "+44 20 44444444", "07777 777777", "020 44444444" }; foreach(var phone in phones) Console.WriteLine(Regex.IsMatch(phone, regex)); } } }
run
|
edit
|
history
|
help
0
concurrentStack
decimal to binary conversion
ReverseArrayC#
hi
Better Random number blocks
FINAL PRIME NUMBER GENERATOR IN C#
haha
Problem 5 SingleDigit
3
Addition