fix: 2024/day03 regex expression

This commit is contained in:
Starnakin 2024-12-03 10:15:53 +01:00
parent 90feb14cd5
commit 7be7d0654b
2 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@ with open("input.txt") as f:
total: int = 0 total: int = 0
for x, y in re.findall("mul\(([0-9]{0,3})\,([0-9]{0,3})\)", text): for x, y in re.findall("mul\(([0-9]{1,3})\,([0-9]{1,3})\)", text):
x, y = int(x), int(y) x, y = int(x), int(y)
total += x * y total += x * y

View File

@ -9,7 +9,7 @@ total: int = 0
do_or_not: bool = True do_or_not: bool = True
for x, y, don_t, do in re.findall("mul\(([0-9]{0,3})\,([0-9]{0,3})\)|(don\'t)|(do)", text): for x, y, don_t, do in re.findall("mul\(([0-9]{1,3})\,([0-9]{1,3})\)|(don\'t\(\))|(do\(\))", text):
if (do != ""): if (do != ""):
do_or_not = True do_or_not = True
elif (don_t != ""): elif (don_t != ""):