コード例 #1
0
        public static string NewPhoneChecker()
        {
            // phone pattern complete
            string phonePattern = RegexAndLoginExpressions.phoneRegex();
            Match  rxPhone      = Regex.Match("", phonePattern);
            string phone        = "";

            while (!rxPhone.Success)
            {
                // Phone Number
                Console.Clear();
                Console.WriteLine("\n ---- Phone 10 digits not starting with 0 ----");
                RegexAndLoginExpressions.quitPrompt();
                phone = Console.ReadLine();
                if (phone.Equals("quit"))
                {
                    return("quit");
                }
                rxPhone = Regex.Match(phone, phonePattern);
                phone   = Regex.Replace(phone, "[/-]", "");
                if (phone.StartsWith("0"))
                {
                    rxPhone = Regex.Match("123", phonePattern);
                }
            }
            phone = Regex.Replace(phone, "[/-]", "");
            return(phone);
        }
コード例 #2
0
        public static string NewLastNameChecker()
        {
            string namePattern = RegexAndLoginExpressions.nameRegex();
            Match  rxLname     = Regex.Match("", namePattern);
            string lname       = "";

            while (!rxLname.Success)
            {
                // Last Name
                Console.Clear();
                Console.WriteLine("\n ---- last name ----");
                RegexAndLoginExpressions.quitPrompt();
                lname = Console.ReadLine();
                if (lname.Equals("quit"))
                {
                    return("quit");
                }
                rxLname = Regex.Match(lname, namePattern);
            }
            return(lname);
        }
コード例 #3
0
        public static string NewFirstNameChecker()
        {
            string namePattern = RegexAndLoginExpressions.nameRegex();
            // phone pattern complete
            Match  rxFname = Regex.Match("", namePattern);
            string fname   = "";

            while (!rxFname.Success)
            {
                // First Name
                Console.Clear();
                Console.WriteLine("\n ---- first name ----");
                RegexAndLoginExpressions.quitPrompt();
                fname = Console.ReadLine();
                if (fname.Equals("quit"))
                {
                    return("quit");
                }
                rxFname = Regex.Match(fname, namePattern);
            }
            return(fname);
        }
コード例 #4
0
        public static string NewPassChecker()
        {
            // password
            string passCheck = RegexAndLoginExpressions.passRegex();

            // phone pattern complete
            string password = "";
            Match  rxPass   = Regex.Match("", passCheck);

            while (!rxPass.Success)
            {
                // First Name
                Console.Clear();
                Console.WriteLine("\n ---- password ----");
                RegexAndLoginExpressions.quitPrompt();
                password = Console.ReadLine();
                if (password.Equals("quit"))
                {
                    return("quit");
                }
                rxPass = Regex.Match(password, passCheck);
            }
            return(password);
        }