Fun with Regex

Yup, said fun with regex. My standard line is the old favorite “I have a problem that I solved with regex and now I have two problems”…

But Josh Bush tweeted about a regular expression game that Erling Ellingsen built.

There’s 15 levels that exercise different expressions in regex.

  1. Plain strings
  2. Anchors –
  3. Ranges
  4. Backrefs
  5. Abba
  6. A man, a plan
  7. Prime
  8. Four
  9. Order
  10. Triples
  11. Glob
  12. Balance
  13. Powers
  14. Long Count
  15. Long Count v2

I love these types of challenges specifically because gives a fun way  to learn new things and experiment without fear. I started playing it yesterday and it’s a fantastic time suck for a geek like me. Without looking up the regex cheatsheet, I got to about 1500 but then I had to dive deeper into backreferences and grouping than I had before. I wish JavaScript supported nested references but oh well.

I’m currently at 3293 but I’m positive I can break 3500 at some point in the near future as I don’t really feel like I’ve cracked Glob, Prime, or Triples.

Go play the Regular Expression game and make sure that you comment with your scores! 🙂