Advertisement
teofarov13

Untitled

Apr 2nd, 2023
594
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function encryptingPassword(arr) {
  2.     let inputs = +(arr.shift());
  3.     let regex = /(.+)>(?<one>[\d]{3})\|(?<two>[a-z]{3})\|(?<three>[A-Z]{3})\|(?<four>[^><]{3})<\1/;
  4.     let counter = 0
  5.     let result=''
  6.     for (let i = 0; i <= arr.length; i++){
  7.        
  8.         if (counter == inputs) {
  9.             break;
  10.         }
  11.         let line = arr[i];
  12.         if (regex.test(line)) {
  13.             let match = regex.exec(line);
  14.             result+=match.groups.one+match.groups.two+match.groups.three+match.groups.four
  15.             console.log(`Password: ${result}`);
  16.         } else {
  17.             console.log(`Try another password!`);
  18.         }
  19.         result = '';
  20.         counter++ ;
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement