This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
More documenting that \p{} defined only for <= U+10FFF
authorKarl Williamson <public@khwilliamson.com>
Wed, 28 Sep 2011 15:36:25 +0000 (09:36 -0600)
committerKarl Williamson <public@khwilliamson.com>
Sat, 1 Oct 2011 15:30:40 +0000 (09:30 -0600)
pod/perldiag.pod
pod/perlrecharclass.pod
pod/perlunicode.pod

index 7e0cdd9..131fbb5 100644 (file)
@@ -1389,6 +1389,16 @@ will not match, because the code point is not in Unicode.  But
 
 will match.
 
+This may be counterintuitive at times, as both these fail:
+
+ chr(0x110000) =~ \p{ASCII_Hex_Digit=True}      # Fails.
+ chr(0x110000) =~ \p{ASCII_Hex_Digit=False}     # Also fails!
+
+and both these succeed:
+
+ chr(0x110000) =~ \P{ASCII_Hex_Digit=True}      # Succeeds.
+ chr(0x110000) =~ \P{ASCII_Hex_Digit=False}     # Also succeeds!
+
 =item %s: Command not found
 
 (A) You've accidentally run your script through B<csh> instead of Perl.
index fef220f..3a10579 100644 (file)
@@ -370,6 +370,17 @@ which notes all forms that have C</i> differences.
 It is also possible to define your own properties. This is discussed in
 L<perlunicode/User-Defined Character Properties>.
 
+Unicode properties are defined (surprise!) only on Unicode code points.
+A warning is raised and all matches fail on non-Unicode code points
+(those above the legal Unicode maximum of 0x10FFFF).  This can be
+somewhat surprising,
+
+ chr(0x110000) =~ \p{ASCII_Hex_Digit=True}      # Fails.
+ chr(0x110000) =~ \p{ASCII_Hex_Digit=False}     # Also fails!
+
+Even though these two matches might be thought of as complements, they
+are so only on Unicode code points.
+
 =head4 Examples
 
  "a"  =~  /\w/      # Match, "a" is a 'word' character.
index f00b110..2d0a671 100644 (file)
@@ -366,6 +366,14 @@ of which under C</i> matching match C<PosixAlpha>.
 numerals, come in both upper and lower case so they are C<Cased>, but aren't considered
 letters, so they aren't C<Cased_Letter>s.)
 
+The result is undefined if you try to match a non-Unicode code point
+(that is, one above 0x10FFFF) against a Unicode property.  Currently, a
+warning is raised, and the match will fail.  In some cases, this is
+counterintuitive, as both these fail:
+
+ chr(0x110000) =~ \p{ASCII_Hex_Digit=True}      # Fails.
+ chr(0x110000) =~ \p{ASCII_Hex_Digit=False}     # Fails!
+
 =head3 B<General_Category>
 
 Every Unicode character is assigned a general category, which is the "most