Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(args) {
- const numPass = args.shift();
- const regPat = /(\S+)>(?<password>[0-9]{3}\|[a-z]{3}\|[A-Z]{3}\|[^<>]{3})<\1/g;
- for (let index = 0; index < numPass; index++) {
- const element = args[index];
- const isOk = element.match(regPat);
- if (isOk) {
- const takePassword = regPat.exec(element);
- if (takePassword !== null) {
- const { password } = takePassword.groups;
- const clearPassword = password.replace(/\|/g, '');
- console.log(`Password: ${clearPassword}`);
- }
- } else {
- console.log('Try another password!');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement