The 5th Annual Regular Expression Day (And Prizes) - June 1st, 2012
Posted June 1, 2012 at 3:10 PM by Ben Nadel
It's June 1st. You know what that means - it's the 5th Annual Regular Expression Day! A day where we set aside our differences and come together, unified as one people, brought together by our love of pattern matching! And, while we all have access to that love year-round, let's make sure we take today to share that love with each other.
NOTE: If you are already completely lost and have no idea what I'm talking about, please checkout my video and slide presentation - Regular Expressions, Extraordinary Power. They will blow your mind and change your world forever.
This year, I was definitely late out of the starting block. I didn't come up with the contest idea until last night. Then, I spend a few frantic hours before bed (and a few more this morning) trying to put it together. All in all, though, I think it came out pretty well! I just hope you have fun playing!
Enough Jibber-Jabber - What Can I Win?!
The point of the game is to match as many Regular Expression patterns in the time allotted (one minute). For each pattern, you have to supply a snippet of Text that the given pattern would match. There will be one grand-prize given to the highest scorer; and, several smaller prizes given, at random, to participating contestants.
Since I'm late at getting this public, I'll let it run until Monday night (June 4th).
NOTE: Patterns in this game are NOT case-sensitive.
Wow, I was lousy at that! It would be nice if it showed which ones I got right at the end after it's insulted me with "you've got 1 right". ;-)
Normally we work the other way around trying to create a regex to achieve a goal, so it was fun and proves what a great logical language regexes are for COMPUTERS to understand! :-D Good stuff Ben, you never fail to entertain through good tutorials, humour or challenges.
Love the game, Ben. I've played through it a few times, scoring between 14 and 23. So hey, other players, at least you know a number to beat. :)
With some additional features, I think this could actually be a great learning tool. If you ever end up spending more time on it, one thing that might be interesting to look into is some kind of pattern generation/randomization (within constraints), rather than choosing randomly from a list of prewritten patterns.
I love the idea, it was entertaining :)
Okay, I'm done... I feel my score is very respectable... 33 :-)
Can't get past that number...
I need some work with the \b selector... the \b..\b. something or other one always made me pause way too long.
THANKS soo much for putting this together! Regex is the tool that everyone should master
33? That's just not natural! Solving just over 1 per second. You needn't bother owning a computer with that kind of brain power inside your noggin. ;-)
Better fire it up again, @Ben Dalton. I just scored 34. ;-) And I'm a slow typist.
Damn, and I was kinda proud of my little ol' 5...
Make that 36. :)
Jason Salvo, I played through it more than a dozen times, so the numbers I (and probably Ben Dalton) posted aren't entirely fair.
Ben Nadel, some of the regexes are very well designed for this challenge. As Ben Dalton mentioned, the \b..\b style regexes, as well as some of those with backreferences, take a moment to think through, which is good. I also like the ones that have a shorter answer (which saves on typing time) than is immediately obvious.
oh man! I was hoping you'd do the pix thing again this year so I'd at least have half a chance! Oh well...I still tried lol. I probably did the worst. I hope you'll leave it up, though, so we can practice with it. I know my score probably won't improve any, but I bet it will help me at least learn a little about reg ex's a little more.
Thanks for having this! It was fun.
Great game. I keep playing even though the contest is over. You should create a leader board and stats (#attempts, % correct, etc) for next year's contest.
Best regex day yet. I hope you'll consider expanding on the game as Quincy suggested. Maybe add a time penalty/reward for getting answers wrong/right. (I found that I can cheat by just skipping the \b..\b one.)
I love the way that a lot of the regexes have an easily guessable answer (like /M(o)(\1|u)se/), but it takes a bit of thinking to figure out why the answer is correct and what not-so-obvious alternatives exist. How can you exploit that? Maybe present the same regex again later and ask for a different answer to the one that was given previously?
Glad everyone is/had a fun time playing! I know it's taking me a while to get all the scoring done - it's been a busy week. Definitely getting to it today!
I think you should make next "year's" (not sure I really want to wait that long) contest about submitting material for your "input" file. This is one of those fun ways to learn, and more examples would really improve it.
First, I want to thank everyone for their participation - this year was incredibly successful! I had literally *hundreds* of submissions! Totally badass! And, it was awesome to see some people really progressively get better for like 5-10 submissions! Very cool :D
Ok, so taking some extreme outlier into account, the grand winner is:
Jacob Bailey with 41 matches!
Then, I selected 4 additional winners from the submission:
* Angela Buraglia
* Daniel Roberts
* Patrick McElhaney
* Jason Salvo
I'll email you guys regarding your prizes.
Thanks again to everyone who participated. I'll put the code for the game up on GitHub shortly for anyone who is interested!
Wow, awesome! I knew I did well, but I have to admit that I never actually expected to hold the high score.
Thanks for the game Ben! It was insanely fun and I certainly learned a few new tricks while playing.
My regFu is much stronger now... :>
In case anyone is interested, here is the GitHub repository for the RegEx 2012 Game:
Definitely not "best practices" architecture; but not bad for whipping together in 4 hours :)
That was fun. I did play the game a few more times. the score improved, but I guess it wouldn't ever improve enough to win or anything. At least I'm learning regex a little better (I think).