Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- registration = (input) => {
- let N = Number(input.shift()),
- successfulCount = 0;
- for(let i = 0; i < N; i++) {
- let registration = input.shift();
- let match = registration.match(/U\$(?<username>[A-Z][a-z]{2,})U\$P@\$(?<password>[A-Za-z]{5,}[0-9]+)P@\$/);
- if(match !== null) {
- console.log(`Registration was successful\nUsername: ${match.groups.username}, Password: ${match.groups.password}`);
- successfulCount++;
- } else {
- console.log('Invalid username or password');
- }
- }
- console.log(`Successful registrations: ${successfulCount}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment