2020-07-09 - By Robert Elder
Regular expressions are an extremely powerful tool that you can use to become a very productive software developer. This web site features a number of articles that cover topics related to regular expressions. Here is an overview of them:
Visuals & Simulation
The Regular Expression Visualizer Tool is an interactive tool you can use to visualize and understand regular expressions. You can input a regular expression and see how the regular expression parser will break it down and compile it into a control flow graph. In addition, you can specify a specific string for your regex and follow through the matching process to understand why it fails or succeeds to match. Here is a video describing the tool:
The Character Class Search Explainer is an interactive tool that can help you understand how basic character classes work. It allows you to input simple regular expressions that only contain character classes. These simple regular expressions are then translated into a very short C program that shows exactly how the expression would be matched.
The Character Class Visualizer is an interactive tool that is designed to make it crystal clear which characters are actually matched by a given character class. For simple character classes like '[abc]' it's easy to understand which characters are supposed to be matched, but for character classes like [\\\]\.\w] this is not as clear. With this visualization tool, you'll see a listing of exactly which characters are or are not matched.
Lectures & Explanation
Character Classes in Regular Expressions - A Gentle Introduction is part 1 of a series designed to give people an intuitive understanding of what regular expressions actually represent. This part of the series focuses on explaining how character classes work and shows how you can think of a character class as just a simple list of potential characters to match:
Character Ranges & Class Negation in Regular Expressions continues where part 1 left off: By continuing the discussion on what characters need to be escaped inside a character class. This part also provides visuals to disambiguate between the literal characters that are written in a regular expression and the actual characters that they will match (since escaping rules can make the difference confusing):
Alternation This article discusses how 'alternation' works. Alternation can be used match one of several alternative patterns.
Quantifiers This article discusses what 'quantifiers' are and how they work. Quantifiers are used to repeat parts of your regular expression without having to type them out multiple times. There are 3 major groups of quantifiers: greedy, lazy and possessive.
Character Escaping This article provides an overview of the rules for 'escaping' characters in a regular expression. In order to simplify things, the escaping rules are broken down into rules for what to escape 'outside' and 'inside' a character class.
Advanced Regular Expression Resources
The article Regular Expression Test Cases provides a list of test cases for the custom-written regular expression engine that was used to make the regular expression visualizer tool above. This article may also be useful for anyone wishing to gain a detailed understanding of the syntax of regular expressions.
An LL Grammar For Regular Expression Parsing provides a left-recursive grammar for parsing regular expressions. This may serve as a useful guide to anyone wishing to gain a very detailed understanding of the syntax of regular expressions. It may also be useful to anyone seeking to write their own regular expression engine.
The Regular Expression Visualizer, Simulator & Cross-Compiler Tool
Regular Expression Character Escaping
How Do Regular Expression Quantifier Work?
Interesting Regular Expression Test Cases
How Regular Expression Alternation Works
Character Ranges & Class Negation in Regular Expressions
Character Classes in Regular Expressions - A Gentle Introduction
Why Bother Subscribing?