From d858da19be73ee36c1d3cd841f457c0b5150bc15 Mon Sep 17 00:00:00 2001 From: Heiko Ludwig Date: Tue, 3 Dec 2024 20:48:17 +0100 Subject: [PATCH] don't accept numbers > 999 for the multiplication command --- day_03/program.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/day_03/program.py b/day_03/program.py index bd5f517..519242a 100755 --- a/day_03/program.py +++ b/day_03/program.py @@ -12,7 +12,7 @@ def get_lines(filename: str) -> list: def part1_get_result_sum(lines: list) -> int: result_sum = 0 - pattern = re.compile(r"mul\((\d+),(\d+)\)") + pattern = re.compile(r"mul\((\d{1,3}),(\d{1,3})\)") for line in lines: matches = re.findall(pattern, line) for match in matches: