SHARE
TWEET

Registration

Alexzandur Dec 12th, 2019 150 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input) {
  2.     input.shift();
  3.     let count = 0;
  4.     for (const iterator of input) {
  5.         let text = iterator;
  6.         let pattern = /U\$(?<user>[A-Z][a-z]{2,})U\$P@\$(?<pass>[a-zA-z]{5,}[\d$]+)P@\$/g;
  7.         let match = pattern.exec(text);
  8.         if (match) {
  9.             count++;
  10.             let { user, pass } = match.groups;
  11.             console.log('Registration was successful');
  12.             console.log(`Username: ${user}, Password: ${pass}`);
  13.         } else {
  14.             console.log('Invalid username or password');
  15.         }
  16.     }
  17.     console.log(`Successful registrations: ${count}`);
  18. }
  19. solve([
  20.     '3',
  21.     'U$MichaelU$P@$asdqwe123P@$',
  22.     'U$NameU$P@$PasswordP@$',
  23.     'U$UserU$P@$ad2P@$'
  24. ])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top