// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Text.RegularExpressions; namespace E { public class Program { private static Regex re = new Regex(@"^((\d{8})|(\+\d{10})|(00\d{10}))$"); public static void Test(string s) { Console.WriteLine(s + " : " + re.IsMatch(s)); } public static void Main(string[] args) { Test("1234567"); Test("12345678"); Test("123456789"); Test("+001234567"); Test("+0012345678"); Test("+00123456789"); Test("00001234567"); Test("000012345678"); Test("0000123456789"); } } }