Regular Expressions: How Do They Work?


Dear programmer! I think it’s time we talk about regular expressions. What do you think?

Yes, I understand you know them and can use in most common real-life situations. It’s great! I know some programmers, for whom more complicated regular expressions are quite a black magic. Even though they may have quite a few years of experience. But I don’t want to preach you about how to build a regexp1 to get your problem solved. I intend to explain how they work internally and what consequences it might have for us.

So, where do we start? It actually begins with mathematics.