diff options
author | Karl Williamson <khw@cpan.org> | 2021-01-08 22:02:39 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2021-01-20 06:51:50 -0700 |
commit | a44b2be795f4c5f94384c6f6010860588e144b3c (patch) | |
tree | 29222a81d00b0f896d050060718c9debf4343584 | |
parent | 12abe3c415ac316306426490edddd357e2cac4d3 (diff) | |
download | perl-a44b2be795f4c5f94384c6f6010860588e144b3c.tar.gz |
perlre: Note the other forms of \k<name>
Not all three synonyms were documented.
This also fixes up related comments in regcomp.c to correspond
-rw-r--r-- | pod/perlre.pod | 6 | ||||
-rw-r--r-- | regcomp.c | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/pod/perlre.pod b/pod/perlre.pod index 83a3b08dfa..7d639b02b4 100644 --- a/pod/perlre.pod +++ b/pod/perlre.pod @@ -1003,6 +1003,8 @@ X<\g> X<\k> X<\K> X<backreference> curly brackets for safer parsing. \g{name} [5] Named backreference \k<name> [5] Named backreference + \k'name' [5] Named backreference + \k{name} [5] Named backreference \K [6] Keep the stuff left of the \K, don't include it in $& \N [7] Any character but \n. Not affected by /s modifier \v [3] Vertical whitespace @@ -1763,6 +1765,8 @@ support the use of single quotes as a delimiter for the name. =item C<< \k'I<NAME>' >> +=item C<< \k{I<NAME>} >> + Named backreference. Similar to numeric backreferences, except that the group is designated by name and not number. If multiple groups have the same name then it refers to the leftmost defined group in @@ -1771,7 +1775,7 @@ the current match. It is an error to refer to a name not defined by a C<< (?<I<NAME>>) >> earlier in the pattern. -Both forms are equivalent. +All three forms are equivalent. B<NOTE:> In order to make things easier for programmers with experience with the Python or PCRE regex engines, the pattern C<< (?P=I<NAME>) >> @@ -13907,8 +13907,8 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth) RExC_parse = parse_start; goto defchar; - case 'k': /* Handle \k<NAME> and \k'NAME' */ - parse_named_seq: + case 'k': /* Handle \k<NAME> and \k'NAME' and \k{NAME} */ + parse_named_seq: /* Also handle non-numeric \g{...} */ { char ch; if ( RExC_parse >= RExC_end - 1 |