[fa icon="calendar"] Publié le 02 May 2019 par Hugo Duprat


 

xkcd regular expressions
Source: xkcd
Regular expressions are a concept every developer is likely to struggle with during their career. This article will introduce you three games that are worth playing if you want to level up your regex proficiency so that you won’t waste time looking for a particular feature of the regex language in documentation or tutorials.

Start with the basics: Regex Crossword

regexcrossword

Looks easy at the start… but you’re in for a challenge later! Source: Regex Crossword

What is it? Created by Ole and Maria Michelsen, Regex Crossword just describes itself: your goal is to fill a grid with characters that match the regexes on the vertical and horizontal lines, usually revealing a word or phrase.

Why play it? The difficulty of this game is progressive, making it easy to remember the base concepts and enabling you to understand more and more complex regexes.

There is also a level editor if you want to measure yourself against user-created crosswords or create your own.

Where can I find it? https://regexcrossword.com/

Assess your level on realistic cases: RegexPlay

regexplay

12 exercises to master regexes. Source: RegexPlay

What is it? RegexPlay is a game created by the Machine Learning Lab from the University of Trieste. Your goal is to find a regex that matches all highlighted elements from a piece of content (and only them).

Why play it? This game will make you tackle “real-life” examples you are likely to encounter as a developer, such as URL, IP address or name matching. You will also learn new concepts you wouldn’t find in Regex Crossword, enabling you to match even more complex patterns.

A little bonus if you like some competition: when you clear all the 12 exercises, you will see how well you did, compared to everybody else based on the time you spent on the game.

Where can I find it? http://play.inginf.units.it

Become an expert: Regex Golf

regex golfAnd this is just the warmup. Source: Regex Golf

What is it? In Regex Golf, you not only have to find a regex that matches a list of words, but it also must not match another list. As the “golf” in its name suggests, you also have to find the shortest regex possible. The challenges brought by @steike quickly rise in difficulty, to the point it sometimes doesn’t reflect real-life problems — for instance, finding a regex to match multiples of 3.

Why play it? RegexPlay had only 12 levels, which can be too few to really master the more complex features of the regex language. Playing Regex Golf is an opportunity to do just that, and it will also enable you to create regular expressions specifically meant for not matching specific contents.

I can’t deny it is also a good challenge for your brain!

Where can I find it? https://alf.nu/RegexGolf

Have fun learning regular expressions!

If you happen to know more regex-oriented games, do not hesitate to let me know by sending me a tweet!


Liked this article? Interested in building an app with us?

Contact a React Native expert in Paris




Want to rate this article?
Submit Rating

Topics: regex, expressions, regular expressions