Culture

Game of Geeks: Having Fun with Regular Expressions

15 Sep 2019 6:00am, by

For six years, the site RegExCrossword.com has been offering crossword puzzles made from programming language regular expressions. “Welcome to the fantastic world of nerdy regex fun!” reads a greeting on its home page. It’s like a smaller version of a traditional crossword puzzle — except instead of using words for clues, the contents of each square are described using the familiar syntax for specifying a search pattern.

A perennial favorite, the site’s visitors have now submitted correct answers more than 1,193,436 times. There are over 57,254 registered players, representing a hardy and loyal following. A quick search shows it’s pages have been submitted to Hacker News at least 27 different times — and last week, the same URL finally received over 405 upvotes, and over 59 appreciative comments.

Over the years, it’s an idea that’s also fired the imagination of other geeks, spawning a very 21st-century folk celebration for the tools of our labors. It’s all proof that seeing regular expressions in a fun new context can be educational, cathartic, and occasionally even confidence-boosting. But does it also tell us something about our culture, delivering a fresh perspective on the way that we work using the way that we play?

RegExCrossword tshirt

To probe the tantalizing intrigue of regular expression puzzles, I tracked down software engineer Ole Michelsen, one of the co-founders of RegExCrossword, and asked him to tell me how it all began.

Mystery Hunt 

“The inspiration came from the MIT Mystery Hunt,” Michelsen tells me in an email. The hunt has been an annual tradition at the technology college since 1981. Each year MIT students tackle a surprising variety of mental challenges, according to the event’s website, including anagrams, number puzzles, scavenger hunts, and crossword puzzles.

MIT puzzle hunt via Wikipedia - picture by Barak Michener

The 2013 hunt had featured a record 150 puzzles — and Michelsen remembers that one of the puzzles was a hexagonal regex crossword.

“It was really fun to solve, and we thought that others might have fun solving some slightly easier versions.”

Ole teamed up with his wife Maria Hagsten Michelsen, whose Twitter profile describes her as “a passionate graphic designer and illustrator, who aims to improve the world through visionary and thoughtful design.” Together they decided to make a whole web site full of the crazy regular expression crossword puzzles. And in true geek fashion, they decided to add a few enhancements. Just one example: puzzles can be rotated to make it easier to read the clues…

“We also wanted puzzles that solved to a little word/sentence as a kind of prize.” For example, the solution to a puzzle named “Hamlet” might begin with the letters T-O-B-E-O-R-N-O-T-T-O-B-E…)

They also made sure that the puzzles were formatted for easy printing, so they could be printed out (and solved) on regular printer paper.

And when throngs of enthusiastic geeks started arriving to the site, “We soon realized that we needed an account and ranking/scoring system with trophies etc,” Ole wrote.

But the chief attraction has always been those bedeviling and carefully-constructed puzzles. “The challenge was making puzzles with red herrings but still only one valid solution,” Ole tells me. “We also wanted a gradual increase in difficulty through the challenges, so they all have different themes and difficulty level.

Secrets of the Site

There are now 55 “challenge” puzzles on the site — but that’s really just the beginning. Players can even submit their own puzzles, so there’s now 688 more player-submitted puzzles to choose from. “We have gotten so many great and creative puzzles from the community which is really the reason the site is still active,” Ole acknowledges.

It’s built up a strong following. “At one point we got featured on the front of Hacker News, and it kinda took off from there,” Ole remembers, noting that in the years since, it’s been featured in some other fun contexts.

“At one point we learned that it was being used as course practice material at Berkeley’s Computer Science course. We were featured in the program of a Python conference in Holland. “And LinkedIn even used a copy of the idea for their engineering hiring process.”

And it’s also inspired other geeks to come up with their own creative solutions — and offering variations on the same crazy game. Last week on Hacker News, one fan even shared a linked to some code on GitHub they wrote that solves the puzzles by “generating a bunch of strings that match the regex, and then applying them as constraints.”

And waiting in the GitHub repository of Noah Luck Easterly is a massive 127-cell hexagon puzzle — and a call for others to help create more.

There’s also a site for “Regex Golf,” where players lower their score by using fewer characters in a regular expression to match a long list of words (while not matching the other words on an equally long list).

RegExCrossword is a fun way for programmers to practice with the tools of their trade. It even offers a handy cheat sheet of regular expressions for its players. Just click the question-mark-in-a-circle in the page’s upper-right corner.

Even after six years, Ole is still dreaming of new ways to improve the site.

“Right now I’m working on a mobile version, which is a bit of a rethink since it’s hard to transfer that much complexity to a small screen,” he wrote.

But geeks gotta tinker, and that may be the most inspiring message of all.

He’s taken the act of creating a puzzle for geeks, and made it into an even geekier challenge.


WebReduce

Feature image by Hans-Peter Gauster on Unsplash.

A newsletter digest of the week’s most important stories & analyses.

View / Add Comments

Please stay on topic and be respectful of others. Review our Terms of Use.