fix: 2024/day03 regex expression
This commit is contained in:
parent
90feb14cd5
commit
7be7d0654b
@ -7,7 +7,7 @@ with open("input.txt") as f:
|
||||
|
||||
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)
|
||||
total += x * y
|
||||
|
||||
|
@ -9,7 +9,7 @@ total: int = 0
|
||||
|
||||
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 != ""):
|
||||
do_or_not = True
|
||||
elif (don_t != ""):
|
||||
|
Loading…
Reference in New Issue
Block a user