From c70bdd27015c3d5618b8f4a9dbde70ca672d268e Mon Sep 17 00:00:00 2001 From: Joshua Seigler Date: Fri, 4 Dec 2020 17:31:52 +0000 Subject: [PATCH] Day 4 --- .replit | 2 ++ day04.js | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 .replit create mode 100644 day04.js diff --git a/.replit b/.replit new file mode 100644 index 0000000..f463f3c --- /dev/null +++ b/.replit @@ -0,0 +1,2 @@ +language = "nodejs" +run = "node day04" \ No newline at end of file diff --git a/day04.js b/day04.js new file mode 100644 index 0000000..d500b08 --- /dev/null +++ b/day04.js @@ -0,0 +1,3 @@ +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:(201\d|2020)|eyr:(202\d|2030)|hgt:(1[5-8]\d|19[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] \ No newline at end of file