Advertisement
bebo231312312321

Untitled

Apr 2nd, 2023
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function encryptingPassword(array) {
  2.   let pattern =
  3.     /^([\w\W]+)\>(?<one>\d{3})\|(?<two>[a-z]{3})\|(?<three>[A-Z]{3})\|(?<four>[^\<\>]{3})\<(\1)$/m;
  4.  
  5.   let numb = Number(array.shift());
  6.  
  7.   for (let i = 0; i < numb; i++) {
  8.     let password = array.shift();
  9.     let match = pattern.exec(password);
  10.     if (match !== null) {
  11.       let pass = match[2] + match[3] + match[4] + match[5];
  12.       console.log(`Password: ${pass}`);
  13.     } else {
  14.       console.log("Try another password!");
  15.     }
  16.   }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement