RegEx Crosswords
If you’re like me, you already know or have heard about RegEx (Regular Expressions), but didn’t know that RegEx crossword puzzles existed.
For real though, you should have seen the surprise and shock on my face when I opened the “RegEx World!” miscellaneous challenge on Hackpack 2021 CTF and found a RegEx crossword puzzle.
Even then, I had the confidence to believe that I could crack it since I was already pretty comfortable with regular expressions. A few hours and several million attempts (slight exaggeration) later, I realized that what I was trying to achieve was like a 6th grader who has just learned the elements on the periodic table set out to do a Ph.D. on them.
After the CTF was over though, I set out to educate myself on how to solve such puzzles, and here I am to help you do the same.
Note: If you’re a complete beginner and aren’t familiar with regular expressions, don’t worry I got you.
What are Regular Expressions?
“A sequence of symbols and characters expressing a string or pattern to be searched for within a longer piece of text.” — Wikipedia
That sounds pretty helpful, doesn’t it? :)))
Refer here for more:
A quick RegEx Reference/Recap:
Basics
/ expression / flags
, i.e/[A-Z]+/g
basic format/ hello\?\*\\/
escape special characters with backslashes()
group with parentheses|
logical OR
Character classes
\w
word\d
digit\s
whitespace (tabs, line breaks)\W
NOT word\D
NOT digit\S
NOT whitespace\t
tabs,\n
line breaks.
any character (except newline)
Brackets
[xyz]
match any x, y, z[J-Z]
match any capital letters between J & Z.[^xyz]
NOT x, y, z
Quantification
bob|alice
match bob or alicez?
zero or one occurrencesz*
zero or multiple occurrencesz+
one or multiple occurrencesz{n}
n occurrencesz{min,max}
min/max occurrences
Anchors
hello world
exact match^hello
start of the stringsworld$
end of the string
And with this, we’ve covered our basics pretty well.
Lol yeah, RegEx does look pretty weird to the layman's eyes. But we’re no longer strangers to it, are we? ;)
Regardless of how regular expressions look like the “opposite” of regular, their advantages and use-cases are numerous and their usage helps our tech professionals in more ways than one, leading to their increasing popularity and undiminished fame.
You can read more about the expressions in this great article by GeeksforGeeks or cruise through this free room on TryHackMe by concatenate. They’re both great sources but personally, I’d advise the latter, as you get to work with the expressions as you learn. So do check it out!
Let’s move on to RegEx crosswords.
RegEx Crossword — Unmasked
Though we call it a crossword, a regex crossword is more like Sudoku than a traditional crossword puzzle. Beats me why we still call it a crossword though.
It is interesting to note that the first-ever “on-record” RegEx crossword seems to have been made for the MIT Mystery Hunt (in 2013), and it was on a hexagonal grid to make the value depend on 3 clues instead of the usual of 2 clues.
This might look a little overwhelming to a beginner, as it did for me before I grew more comfortable with them, but I got just the thing to get you acquainted too!
This website is the first to come up when we google “regex crossword” and honestly it’s the best. You can practice on the levels given on the home page which gradually escalate at first, but once you finish the “Double Cross” level, you’re basically all set.
Note: Don’t forget to sign up, just so you can keep track of your progress. Also, while you’re there, check out the “Player puzzles” section too!
On a more personal note, I’d love to show you the puzzle that got me here.
Though I hope that you’d get around to solving it on your own, the answer to this one is: YOUGOTTHISREGEX!
PS: A hint suggesting that ‘only one special character was part of the puzzle’s answer’ was also provided alongside, mind you.
Andddddd that’s it, folks! Hope you enjoyed the article. Happy learning!
The solution to the MIT Mystery puzzle can be found here: https://www.mit.edu/~puzzle/2013/coinheist.com/rubik/a_regular_crossword/answer/index.html
The solution to the HackPack CTF’s puzzle can be found here: https://szymanski.ninja/en/ctfwriteups/2021/hackpack/regex-world/
I hope you don’t need it, but if you’re having trouble with the puzzles on https://regexcrossword.com/, since they don’t have hints or reveal answer options there, you can check and compare your answers from here: https://github.com/deepaksood619/RegexCrossword
The regex reference/recap is not my original content and is taken from https://fireship.io/lessons/regex-cheat-sheet-js/