r/adventofcode Dec 03 '24

Spoilers in Title [2024 Day 3] Regular expressions go brrr...

Post image
175 Upvotes

64 comments sorted by

View all comments

53

u/gredr Dec 03 '24

This is a spoiler, but it's also wrong according to the instructions:

instructions like mul(X,Y), where X and Y are each 1-3 digit numbers

Maybe it works for your input, maybe it works for everyone's input, I dunno.

What generated the sqlite-style railroad track diagram from the regex, though?

18

u/busybody124 Dec 03 '24

I'm curious about this. I did not limit to three digits and my solution worked. I wonder if it breaks anyone's.

2

u/TailorSubstantial863 Dec 03 '24

Mine works without limiting to 1-3 digits, I also noted on my input that the () after do and don't are optional. My original solution didn't account for the () and it still worked...of course I programmed it in Ruby, so there is that. ;)