| Perl-Compatible Regular Expressions (PCRE) |
| Article Index |
|---|
| Perl-Compatible Regular Expressions (PCRE) |
| Page 2 |
| Page 3 |
| Page 4 |
| Page 5 |
| Page 6 |
| Page 7 |
| Page 8 |
| Page 9 |
| Page 10 |
/face\/off/
is the equivalent of the regular expression face/off.
PCRE also expands on the concept of references, making them useful not only as a byproduct of the regex operation, but as part of the operation itself.
In PCRE, it is possible to use a reference that was defined previously in a regular expression as part of the expression itself. Let's make an example. Suppose that you find yourself in a situation in which you have to verify that in a string such as the following:
Marco is a programmer. Marco's specialty is programming.
John is a programmer. John's specialty is programming.
The name of the person to whom the sentence refers is the same in both positions (that is, "Marco" or "John"). Using a normal search-and-replace operation would take a significant effort, and so would using a POSIX regex, because you do not know the name of the person a priori.
With a PCRE, however, this operation is trivial. You start by matching the first portion of the string. The name is the first word:
| Users' Comments (0) |
|
No comment posted








