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