Uppercase and lowercase letters, special characters, numbers, and more than four eight selected three, in full compliance with validation

Uppercase and lowercase letters, special characters, numbers, at least eight or more verification

Positive 则表 达式:?! ^ (?! [A-Za-z0-9] + $) (?! [A-z0-9 \\ W] + $) ([A-Za-z \\ W] + $) (?! [A-Z0-9 \\ W] + $) [a-zA-Z0-9 \\ W] {8,} $

Split explanation:

               (1) ^ matches the beginning

    (2) (?! [A-Za-z0-9] + $) is later matched insufficiency (uppercase or lowercase letters or numbers) positions, excluding (uppercase letters, lowercase letters, numbers) of one kind of two kinds of three combinations

    (3) (?! [A-z0-9 \\ W] + $) Similarly, excluded (lowercase letters, numbers, special symbols) of one kind of two-kind three combination

    (4) (?! [A-Za-z \\ W] + $) Similarly, excluded (uppercase letters, lowercase letters, special characters) is one kind of two-kind three combination

    (5) (?! [A-Z0-9 \\ W] + $) Similarly, excluded (uppercase, arrays, special symbols) of one kind of two-kind three combination

    (6) [a-zA-Z0-9 \\ W] match (lowercase or uppercase letters or numbers or special characters) excluded because of the combination of the above, so only four combinations are included in the

    (7) {8, 8} or more

    (8) end of the string $

String testString1 = " a1234567 " ; // lowercase letters, numbers 
            String testString2 = " A1234567 " ; // uppercase letters, numbers 
            String testString3 = " AB123456 " ; // case letters, numbers 
            String testString4 = " .1234567 " ; // special characters, numbers 
            String testString5 = " ! @ # $% ^ & A " ; // special characters, lowercase 
            String testString6 = " @ # $% ^ & B! " ;//Special characters, uppercase letters 
            String testString7 = " aB @ # $% ^ &! " ; // special characters, uppercase and lowercase letters 
            String testString8 = " B @ # $% ^ 12! " ; // special characters, numbers, uppercase letters 
            String testString9 = " ! @ # $% ^ A 12 " ; // special characters, numbers, lowercase letters 
            String testString10 = " aB @ # $% ^ 12! " ; // special characters, numbers, upper and lowercase letters 
            Regex regexMatch = new new the Regex ( " ^ (?! [A-Za-Z0-9] + $) (?! [\\ W is A-Z0-9] + $) (?! [A-Za-Z \\ W is] + ?! $) ([\\ W is A-Z0-9] + $) [A-zA-Z0-9 \\ W is]. 8 {,} $ " );
            Console.WriteLine ( " lowercase letters, numbers Test: " + regexMatch.IsMatch (testString1)); 
            Console.WriteLine ( " uppercase, digital test: " + regexMatch.IsMatch (testString2)); 
            Console.WriteLine ( " lowercase letters digital test: " + regexMatch.IsMatch (testString3)); 
            Console.WriteLine ( " special characters, numbers test: " + regexMatch.IsMatch (testString4)); 
            Console.WriteLine ( " special characters, lowercase test: " + REGEXMATCH .IsMatch (testString5)); 
            Console.WriteLine ( "Special characters, uppercase letters test: " + regexMatch.IsMatch (testString6)); 
            Console.WriteLine ( " special characters, uppercase and lowercase letters test: " + regexMatch.IsMatch (testString7)); 
            Console.WriteLine ( " special characters, numbers, test capital letters: " + regexMatch.IsMatch (testString8)); 
            Console.WriteLine ( " special characters, numbers, lowercase letters test: " + regexMatch.IsMatch (testString9)); 
            Console.WriteLine ( " special characters, numbers, case test letters: " + regexMatch.IsMatch (testString10));

 


Special characters, lowercase letters, numbers, at least eight combinations of four selected three

 Positive 则表 达式 ^ (?! [A-zA-Z] + $) (?! [A-Z0-9] + $) (?! [AZ \\ W _] + $) (?! [A-z0- 9] + $) (?! [az \\ W _] + $) (?! [0-9 \\ W _] + $) [a-zA-Z0-9 \\ W _] {8,} $

Guess you like

Origin www.cnblogs.com/TechSingularity/p/12165992.html