Looking Ahead and Behind
All the expressions used thus far have matched text, but sometimes you may want to use expressions to mark the position of text to be matched (in contrast to the matched text itself). This involves the use of lookaround (the capability to look ahead and behind), which will be explained in this lesson.
Again, we’ll start with an example. You need to extract the title of a Web page; HTML page titles are placed between
</title> tags in the
<head> section of HTML code. Here’s the example:
<head> <title>Ben Forta's Homepage</title> </head>