February 2004
Intermediate to advanced
160 pages
2h 27m
English
The previous lesson introduced subexpressions as a way to group characters into sets. A primary use of this type of grouping is to be able to properly control repeating pattern matches (as was demonstrated in that lesson). This lesson looks at the other important use of subexpressions—working with backreferences.
The best way to understand the need for backreferences is to look at an example. HTML developers use the header tags (<H1> through <H6>, with corresponding end tags) to define and format header text within Web pages. Suppose you needed to locate all header text, regardless of header level. Here’s the example:
<BODY><H1>Welcome to my Homepage</H1>Content is divided into two sections:<BR> ...
Read now
Unlock full access