Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(arr) {
- const regex = /[@#]+([a-z]{3,})[^a-z\d]*\/(\d+)\/[^a-z\d]*[@#]*/gm;
- const eggs = [];
- for (let str of arr) {
- let matches = str.matchAll(regex);
- for (let match of matches) {
- const col = match[1];
- const am = parseInt(match[2], 10);
- eggs.push(`You found ${am} ${col} eggs!`);
- }
- }
- for (let egg of eggs) {
- console.log(egg);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement