summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2012-03-06 09:07:46 -0700
committerKarl Williamson <public@khwilliamson.com>2012-03-06 09:17:52 -0700
commit9af81bfe7273a3b8fb9a4bf495609d5da31c3fb4 (patch)
treed529015d9043d948d4f5fbe689f22da0ee30bc97
parent1dc2b704631c7fdc4c58e877c2f17811dc72bc6f (diff)
downloadperl-9af81bfe7273a3b8fb9a4bf495609d5da31c3fb4.tar.gz
pods: Note future deprecation of unescaped "{"
-rw-r--r--Porting/perl5160delta.pod17
-rw-r--r--pod/perlre.pod19
2 files changed, 34 insertions, 2 deletions
diff --git a/Porting/perl5160delta.pod b/Porting/perl5160delta.pod
index e55b6dfa30..a117886643 100644
--- a/Porting/perl5160delta.pod
+++ b/Porting/perl5160delta.pod
@@ -895,6 +895,23 @@ itself.
C<substr> no longer calculates a value to return when called in void
context.
+=item Literal C<"{"> characters in regular expression patterns
+
+It is planned starting in v5.20 to require a literal C<"{"> to be
+escaped by, for example, preceding it with a backslash. In v5.18, a
+deprecated warning message will be emitted for all such uses. Note that
+this only affects patterns which are to match a literal C<"{">. Other
+uses of this character, such as part of a quantifier or sequence like in
+the ones below are completely unaffected:
+
+ /foo{3,5}/
+ /\p{Alphabetic}/
+ /\N{DIGIT ZERO}
+
+The removal of this will allow extensions to pattern syntax, and better
+error checking of existing syntax. See L<perlre/Quantifiers> for an
+example.
+
=back
=over 4
diff --git a/pod/perlre.pod b/pod/perlre.pod
index 772a8bc418..b69c359006 100644
--- a/pod/perlre.pod
+++ b/pod/perlre.pod
@@ -513,8 +513,23 @@ X<metacharacter> X<quantifier> X<*> X<+> X<?> X<{n}> X<{n,}> X<{n,m}>
(If a curly bracket occurs in any other context and does not form part of
a backslashed sequence like C<\x{...}>, it is treated
-as a regular character. In particular, the lower bound
-is not optional.) The "*" quantifier is equivalent to C<{0,}>, the "+"
+as a regular character. In particular, the lower quantifier bound
+is not optional. However, in Perl v5.18, it is planned to issue a
+deprecation warning for all such occurrences, and in Perl v5.20 to
+require literal uses of a curly bracket to be escaped, say by preceding
+them with a backslash or enclosing them within square brackets, (C<"\{">
+or C<"[{]">). This change will allow for future syntax extensions (like
+making the lower bound of a quantifier optional), and better error
+checking of quantifiers. Now, a typo in a quantifier silently causes
+it to be treated as the literal characters. For example,
+
+ /o{4,3}/
+
+looks like a quantifier that matches 0 times, since 4 is greater than 3,
+but it really means to match the sequence of six characters
+S<C<"o { 4 , 3 }">>.)
+
+The "*" quantifier is equivalent to C<{0,}>, the "+"
quantifier to C<{1,}>, and the "?" quantifier to C<{0,1}>. n and m are limited
to non-negative integral values less than a preset limit defined when perl is built.
This is usually 32766 on the most common platforms. The actual limit can