Learning Perl on Win32 Systems

Learning Perl on Win32 SystemsSearch this book
Previous: 6.4 ExercisesChapter 7Next: 7.2 Simple Uses of Regular Expressions
 

7. Regular Expressions

Contents:
Concepts About Regular Expressions
Simple Uses of Regular Expressions
Patterns
More on the Matching Operator
Substitutions
The split and join Functions
Exercises

7.1 Concepts About Regular Expressions

A regular expression is a pattern - a template - to be matched against a string. Matching a regular expression against a string either succeeds or fails. Sometimes, the success or failure may be all you are concerned about. At other times, you will want to take a matched pattern and replace it with another string, parts of which may depend on exactly how and where the regular expression matched.

Regular expressions are used by many programs: editors, search utilities, and word processors. Each program has a different set of (mostly overlapping) template characters. Perl is a semantic superset of all of these tools - any regular expression that can be described in one of these tools can also be written in Perl, but will not necessarily use exactly the same characters.


Previous: 6.4 ExercisesLearning Perl on Win32 SystemsNext: 7.2 Simple Uses of Regular Expressions
6.4 ExercisesBook Index7.2 Simple Uses of Regular Expressions