241 |
.rs |
.rs |
242 |
.sp |
.sp |
243 |
The sequence \eg followed by a positive or negative number, optionally enclosed |
The sequence \eg followed by a positive or negative number, optionally enclosed |
244 |
in braces, is an absolute or relative back reference. Back references are |
in braces, is an absolute or relative back reference. A named back reference |
245 |
discussed |
can be coded as \eg{name}. Back references are discussed |
246 |
.\" HTML <a href="#backreferences"> |
.\" HTML <a href="#backreferences"> |
247 |
.\" </a> |
.\" </a> |
248 |
later, |
later, |
1325 |
matches "rah rah" and "RAH RAH", but not "RAH rah", even though the original |
matches "rah rah" and "RAH RAH", but not "RAH rah", even though the original |
1326 |
capturing subpattern is matched caselessly. |
capturing subpattern is matched caselessly. |
1327 |
.P |
.P |
1328 |
Back references to named subpatterns use the Perl syntax \ek<name> or \ek'name' |
There are several different ways of writing back references to named |
1329 |
or the Python syntax (?P=name). We could rewrite the above example in either of |
subpatterns. The .NET syntax \ek{name} and the Perl syntax \ek<name> or |
1330 |
|
\ek'name' are supported, as is the Python syntax (?P=name). Perl 5.10's unified |
1331 |
|
back reference syntax, in which \eg can be used for both numeric and named |
1332 |
|
references, is also supported. We could rewrite the above example in any of |
1333 |
the following ways: |
the following ways: |
1334 |
.sp |
.sp |
1335 |
(?<p1>(?i)rah)\es+\ek<p1> |
(?<p1>(?i)rah)\es+\ek<p1> |
1336 |
|
(?'p1'(?i)rah)\es+\ek{p1} |
1337 |
(?P<p1>(?i)rah)\es+(?P=p1) |
(?P<p1>(?i)rah)\es+(?P=p1) |
1338 |
|
(?<p1>(?i)rah)\es+\eg{p1} |
1339 |
.sp |
.sp |
1340 |
A subpattern that is referenced by name may appear in the pattern before or |
A subpattern that is referenced by name may appear in the pattern before or |
1341 |
after the reference. |
after the reference. |