Regular expressions might seem arcane, but if you do any kind of software, they are a powerful hacker tool. Obviously, if you are writing software or using tools like grep, awk, sed, Perl, or just about any programming language, regular expressions can simplify many tasks. Even if you don’t need them directly, regular expression searches can help you analyze source code, search through net lists, or even analyze data captured from sensors.
If you’ve been using regular expressions for a long time, they aren’t very hard. But learning them for the first time can be tedious. Unless you try your hand at regular expression crosswords. The clues are regular expressions and the rows and columns all have to match the corresponding regular expressions.
For example, consider this puzzle (which is already filled out):
This puzzle has a theme (The Beatles). The first across clue says that the two characters have to be an HE or an LL or one or more Os (two, then, in this case). The first down clue says the characters can’t be S, P, E, A, or K. So even though the second across clue says the lower left cell could be an A (in PLEASE), that would violate the down clue.
Of course, this is a super simple puzzle, but the site has many more puzzles of increasing difficulty. If you prefer your puzzles in hardware, that’s ok. If you want to work a different kind of puzzle, you might look at our Omnibus.
18 thoughts on “Crosswords Help You Learn Regular Expressions”
I’ve gone through Intermediate and already learned a few things!
Yep. Regex – lead balloons, they have a lot in common.
Here’s the REGEX rules –
1) Avoid Regex at all costs
2) Tell people you know all about regex when you don’t
3) Then you have to do that server side MOD_REWRITE, google it – someone else is sure to have done it before – then don’t tell anyone.
4) Now you’ve mastered regex
#1 might be why you don’t learn them. It is like saying “Driving is hard, so take the bus every chance you get.”
Just to beat someone else to it:
#1 is because 1 *have* learnt regex! Try to use Apache MOD_REWRITE without regex!!!
It’s a pain to write efficient parsers (apart from MOD_REWRITE) and even then regex always comes with a significant performance cost.
If you need to do something with regex then someone has probably done it before and they have probably made it as efficient as it can be so google it! and save yourself a lot of time.
There are almost always alternatives to regex and they are almost always more efficient. In rare occasions you actually need regex.
And then there is that readability issue that makes it the worst code in the world!!!!
So tell me what very simple function this regex does …
Oh, and I almost forgot
If there is ever justification for killing another human being … it’s because they used regex in a (My)SQL query!!!
At first glance that looks like a regex for validating email addresses.
Regular expressions aren’t hard. What’s hard is the syntax your regular expression parser uses and to make your regexs actually do the thing you intend them to do…
http://www.drdobbs.com/embedded-systems/irregular-expressions/240157655 — someone made a library for this, but I can’t find a link off hand.
I was thinking of this one: https://github.com/benlast/grimace
Linked from the article, too, is the regular expression library of expressions: http://regexlib.com
That’s how the first level of this year’s gchq puzzle is solved.
To debug your regular expressions:
I think the real challenge and art to Regex is crafting them in such a way as to make your intentions clear to yourself and to others, especially after months or years have passed. If one is capable of doing this then I suspect they will instantly vanish in a flash of enlightenment and become an energy being of unlimited power.
There is nothing regular about regular expressions.
Heh, I’ve been using regular expressions to cheat at scrabble for over 20 years now.
Please be kind and respectful to help make the comments section excellent. (Comment Policy)