Practical examples

Since the matching of regex is a dynamic process, we need to provide slideshow mode examples. These are best viewed with a recent browser. You should use navigation buttons for exploring each examples.

In these example we don’t use any particular language syntax for regex or input text. We will use \n and the like for special character in input text but we will not escape in quotes or even slashes.

Special symbols are used to mark position:

* Saved options for backtracking will be shown over the text and under the regex using symbols. * Match tries will be shown under the text using ^ symbols. * Successful match will be shown under the text using ¯ symbols. * Part of the regex currently driving the process will be shown over the regex using _ symbols.

Introductory example

Initial state

    Step 1 of 9

This first example is really simple, but it already shows how complex and inefficient could be backtracking in regular expressions. More illustrations of an NFA engines is available:

See also...