Next time you’re trying to write some regex, check out regex.help - it should make your task much easier. A couple of weeks ago, after Secretwords was finished, a colleague pointed me towards grex. It’s a really neat tool to help you write regex.

The main idea is that you provide a couple of examples of the text you want to match and grex spits out a pattern matching all of them.

Usually, the way you write regex is probably something like this:

  1. have one or more examples of the thing you want to match in your head,
  2. write a regex that you think might match them,
  3. try it out,
  4. find out it’s wrong, fix it and try again.

This is fine and there are many tools already, which help you get there. However, with grex you can skip a step:

  1. enter one or more examples of the thing you want to match,
  2. you now have a regex and it’s correct (!!!),
  3. it’s likely not exactly what you want though, so you can still iterate.

I think this is pretty neat. Since I’m currently in the Elixir/Phoenix/LiveView honemoon land, this also gave me a chance to play with rustler, which is an Elixir library allowing you to embed some Rust code. I was very pleasantly surprised how easy it was to plug it all together.

Of course, another post, about how I built regex.help is on the way. One fun difference from Secretwords: I deployed regex.help on fly.io and I’m very excited about this platform.