An Introduction to Regular Expressions Matching Rules 40 of 50 : [PREV] [NEXT]

Matching Rules

The Perl Engine uses a nondeterministic finite-state automation (NFA) to find a match. That is, it keeps track of what it has tried and what it hasn't. When a pattern doesn't match, the engine backs up and tries something else. This is called backtracking.

The order of the rules specifies by which order the Engine tries matching. The phrase "left-most, longest match" means that overall Perl prefers the left-most over longest.

As the rules are defined recursively, it may take some time getting used to them. These rules are based on the popular "Programming Perl" book.


© 2003 Barbie barbie@missbarbell.co.uk Home http://birmingham.pm.org/