How to practice regular expressions more intuitively

As a mediocre corpus and python user, Regular expression indeed helps me do string searching more efficiently. But at the same time, I found that using regex sometimes is cumbersome, because:

  1. I might don’t remember what the search pattern means. In traditional regex teaching class, you probably hear your teacher says, “$ mataches the ending position of the string; [^]matches a character that is not included in the bracket”. But even with examples, this explanation doesn’t help us too much. We probably will forget them after the class.
  2. I’m not sure if there’s any errors in my regex. Only after I hit the search button and nothing retrieved, I realize there may be some errors. What’s worse, I don’t know where the errors are.

These problems push me to find some tools to help me learn regex, more intuitively. Then, Regulex got my attention.

Regulex is a JavaScript Regular Expression Parser & Visualizer. It can not only visualize the search pattern instantly, but also spot the possible errors.

Here is a sneak peek at the graph of Regulex:

Now, there is yet another feature I would love to see in Regulex. That is, I want to see the results retrieved from real data instantly after I type the pattern. Unfortunately, this tool doesn’t support it. But I found another tool that can meet the needs: Expressions.

Expressions is a Mac App with which you can have a live preview of what you write. The only downside of this app is that it’s commercial. But if you happen to have Setapp subscription, you can download it for free.

image.png