As a data analyst, you often have to turn input data into a consistent format in order to perform further analysis. Regular expression, or regex for short, is a commonly used tool for parsing text input.

Learning regex may seem daunting at first because of its syntax. But like learning any other skill, the more you practise using regex, the more adept you will be at it. Regex Crossword is a good way to get some of that practice. We’ll go through the steps to solve two Regex Crossword puzzles below – one Beginner and one Intermediate.

Solving a Beginner Regex Crossword

The first puzzle we’ll look at is Beatles.

  • The clue for column 2 says the answer is either EP, IP or EF, so the cell in row 2 column 2 can only be either P or F.
  • Row 2 is any of the characters PLEASE, repeated one or more times. Since F is not an option, row 2 column 2 must be a P.

  • Now, let’s look at the clue for row 1. The answer here is either HELL or multiple instances of O, so the cell in row 1 column 2 can only be E, L or O.
  • We know from the clue for column 2 that the same cell can be E or I.
  • This narrows down row 1 column 2 to E, and by extension row 1 column 1 is H.

  • The clue for column 1 says the answer is any character except SPEAK, repeated one or more times.
  • Since row 2 is limited to the characters PLEASE, we can conclude that row 2 column 1 must be L, since it appears in PLEASE but not SPEAK.

And there goes our first Regex Crossword! The solution is aptly the name of a Beatles song.

Solving an Intermediate Regex Crossword

Next, we’ll tackle a more difficult puzzle – Technology.

Into the breach

  • The clues are a little more involved with this puzzle.
  • We’ll look at the clue for column 4 first. This says the answer is N or A, repeated zero or more times. However, the cells cannot be left blank (different from having a space in one of the cells, which is indeed legitimate with regex syntax \s).
  • So, in fact this clue is the same as saying the answer can only consist of N or A, though we are not told in what order and how many times each letter may appear. It would be useful to combine this information with the other clues though.
  • Row 1 is any of the letters RUNT, again repeated zero or more times. From this we can deduce row 1 column 4 cannot be A and has to be N.
  • The clue for row 2 tells us the cell in row 2 column 4 is one of the characters from HAT.
  • Similarly, this leaves only A for that cell when we consider that column 4 can only contain N or A.
  • The clue for row 2 also plainly tells us that row 2 column 1 is just an O.

  • Looking at the clue for column 1, we can see that the answer has to end in either NO or ON. From this, we know that row 3 column 1 must be N.
  • What does the clue for row 3 tell us? There is a capture group for the first character, and this capture group (\1) appears again at the end. So, row 3 column 4 is also N.
  • The rest of the clue helps us fill in the whole row as NDON.

Almost there…

  • Can we deduce anything else from the clue for column 1? We see that row 1 column 1 is any character but NRU.
  • On the other hand, row 1 consists of any of the letters RUNT, repeated zero or more times. So, row 1 column 1 can only be T.
  • The clue for column 2 says the answer is pieced together from a combination of D, FU and UF, repeated one or more times. In short, it could be DFUDUFFUDUFD or DDD.
  • We have already filled in D as the last letter here, so we’re left with FUDUFD or DDD. Again, row 1 can only use the letters RUNT, so the answer for column 2 must be UFD.

  • We’re on the home stretch now! Knowing column 3 ends in O and that the entire column is made up of zero or more occurrences of FOA and R, we can see that row 2 column 3 is F.
  • And cross-referencing with the clue for row 1 again, we know that R is the only possibility for row 1 column 3.

Reading across the rows, we see IT support’s favourite line:


There are many more puzzles on the Regex Crossword website, including ones created by the community. Challenge yourself and see how you go with these puzzles – and perhaps write one of your own once you feel more comfortable with regex!

 

Vincent Ging Ho Yim
Author: Vincent Ging Ho Yim

Vincent has always enjoyed learning new things as well as finding elegant and efficient solutions to problems since childhood. He studied linguistics at university and has subsequently worked in theatre lighting and broadcast captioning. In his previous job he found his passion working with data and decided to pursue a change in career. In his spare time he likes reading, learning languages (both human and programming ones) and playing Pic-a-Pix and sudoku. He loves laksa, sushi and burritos.