SHARE
TWEET

Untitled

a guest Dec 8th, 2019 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function checkRegistration(inputArr){
  2.     const workingArr = inputArr.slice();
  3.     let regCount = 0;
  4.     let totalInputs = Number(workingArr.shift());
  5.     for (let i = 0; i < totalInputs; i++){
  6.         let userRegXep = /^(U\$)(?<username>[A-Z][a-z]{2,})\1(P@\$)(?<password>[A-Za-z]{5,}\d+)\3$/g;
  7.         const passedValues = userRegXep.exec(workingArr[i]);
  8.         if (passedValues !== null){
  9.             regCount++;
  10.             let {username, password} = passedValues.groups;
  11.             console.log("Registration was successful");
  12.             console.log(`Username: ${username}, Password: ${password}`);
  13.         }
  14.         else {
  15.             console.log("Invalid username or password");
  16.         }
  17.     }
  18.     console.log(`Successful registrations: ${regCount}`);
  19. }
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