mirror of
https://github.com/seigler/advent-of-code-browser-console
synced 2025-07-26 00:06:10 +00:00
Day 4 optimized, now tweetable
This commit is contained in:
parent
e353642348
commit
8a24959a46
1 changed files with 1 additions and 3 deletions
4
day04.js
4
day04.js
|
@ -1,3 +1 @@
|
|||
let d=document.body.textContent.replaceAll`cid:`.split`
|
||||
|
||||
`;[d.filter(l=>/(:[\s\S]+){7}/m.test(l)).length,d.filter(l=>/((byr:(19[2-9]\d|200[012])|iyr:20(1\d|20)|eyr:20(2\d|30)|hgt:1([5-8]\d|9[0-3])cm|hgt:(59|6\d|7[0-6])in|hcl:#[\da-f]{6}|ecl:(amb|blu|brn|gry|grn|hzl|oth)|pid:\d{9})\b[\s\S]*){7}/gm.test(l)).length]
|
||||
let d=document.body.textContent.replaceAll`cid:`.split`\n\n`;[d.filter(l=>/(:[\s\S]+){7}/m.test(l)).length,d.filter(l=>/((by.:(1...|200[0-2])|iyr:20(1.|20)|eyr:20(2.|30)|hgt:...(n|cm)|hc.:#.{6}|ec.:..[buynlh]|pi.:\d{9})\b[\s\S]*){7}/gm.test(l)).length]
|
Loading…
Add table
Add a link
Reference in a new issue