You Don’t Know Anything About Regular Expressions: A Complete Guide. Regular expressions can be scary...really scary.
Example. How Regexes Work. Mark-Jason Dominus Copyright © 1998 The Perl Journal.
Reprinted with permission. This isn't an article about how to use regexes; you've probably seen plenty of those already. It's about how you would write a regex package from scratch, in a language like C that doesn't already have regexes. I'll demonstrate a new module, Regex.pm, which implements regexes from nothing, in Perl. Here's the basic strategy: We'll see a simple kind of `machine' that reads a input, one character at a time, and then, depending on what's in the input and on the various wheels and gears in the machine, either says `yes' or `no'. When our program wants to see if matched //, it'll do something like this: Look at . Maybe this sounds bizarre, but bizarre or not, it's what Perl does.
Machines We're on a tight budget here, so our machines will be made of circles and arrows instead of wheels and gears, which are expensive. Let's see if this machine says `yes' to the string "abaa". Next the machine will read the "b". Lies. Regular Expression Library. The Regex Coach - interactive regular expressions. Abstract The Regex Coach is a graphical application for Windows which can be used to experiment with (Perl-compatible) regular expressions interactively.
It has the following features: It shows whether a regular expression matches a particular target string. It can also show which parts of the target string correspond to captured register groups or to arbitrary parts of the regular expression. It can "walk" through the target string one match at a time. It can simulate Perl's split and s/// (substitution) operators. Contents Download and installation The Regex Coach together with this documentation can be downloaded from The current version is 0.9.2 - see the changelog for what's new. You should use Windows 2000 or Windows XP with all updates and service packs installed. You also must have the Microsoft runtime library msvcr80.dll installed. If you have a previous version (0.8.5 or earlier) of The Regex Coach installed, uninstall it first before you install the new version! License.