Advertisement
Shokedbrain

regex lab

Jun 3rd, 2022
1,267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text.RegularExpressions;
  4.  
  5. namespace ConsoleApp2
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             List<string> psswrds = new List<string>() { "qwertY", "qwerty_1", "qwertyui", "qwertY_1", "C00l_Pass", "SupperPas1" };
  12.             foreach (var p in psswrds)
  13.             {
  14.                 var test = new Regex(@"^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])[\w]{8,}$").Match(p);
  15.                 Console.WriteLine(test.Success ? $"Пароль {p} подходит" : $"Пароль {p} не подходит");
  16.             }
  17.  
  18.         }
  19.     }
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement