Regex for Fun and Profit

I’ve always been a bit intimidated by regex (or Regular Expressions for the uninitiated). In a nutshell, regular expressions are these archaic looking bits of symbols that when put together look bizarre but actually are used to search for specific characters in a chunk of text/input. For example [^0-9] means search for the first non-numeric character (the ^ is a not, so [0-9] would be search for the first numeric character). I’ve used them a few times, but only by looking up other peoples versions and mucking around with it until it it gives me something like what I want.

Then Ava introduced me Regex Crossword and I knew that if she could do it I could sure as heck learn it too. I breezed through (or to be more accurate bashed through utterly confused) the introduction and part of the beginner puzzles and then got royally stuck. I had never formally learned regex and still didn’t have a clue what half of it meant. Off I went searching for a good tutorial, which was harder than I thought.

I first found Learn Regex the Hard Way, and while I normally like the Learn Code the Hard Way stuff the regex version isn’t finished and wasn’t really helping. I like interactive things that tell me whether I am even on to the right track of a clue. But then I found RegexOne which checked all my boxes! It gives you a bit of a lesson on each new character and then makes you test it out before you move on to the next lesson. I completed the beginning tutorials on there and decided to try the Crosswords again, feeling much more confident.

I got stuck again almost immediately. It was time for some good old fashioned cheating. I discovered Regexper and at first didn’t think it would be much of a help, but let me tell you, I was wrong. You can copy a regular expression into the text box and it will give you a humanized version with actual words and descriptions. With that in my tool belt I was no longer stuck and am now halfway through the intermediate challenges.

I’m not sure I’ll ever really enjoy regex, but at least now it doesn’t just look like magic.

  • Ava

    Arg, sorry! We totally did RegexOne first and I could have told you to go there but I didn’t think about it.