This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
mktables: Change \w definition to match new Unicode's
authorKarl Williamson <public@khwilliamson.com>
Thu, 26 Jul 2012 15:56:27 +0000 (09:56 -0600)
committerKarl Williamson <public@khwilliamson.com>
Thu, 26 Jul 2012 16:38:26 +0000 (10:38 -0600)
Unicode has changed their definition of what should match \w.
http://www.unicode.org/reports/tr18/.  This follows that change.

lib/unicore/mktables
pod/perldelta.pod
t/re/re_tests

index 776741e..4c80597 100644 (file)
@@ -13159,6 +13159,13 @@ sub compile_perl() {
     else {
         $Word += ord('_');  # Make sure this is a $Word
     }
+    my $JC = property_ref('Join_Control');  # Wasn't in release 1
+    if (defined $JC) {
+        $Word += $JC->table('Y');
+    }
+    else {
+        $Word += 0x200C + 0x200D;
+    }
 
     # This is a Perl extension, so the name doesn't begin with Posix.
     my $PerlWord = $perl->add_match_table('PerlWord',
index a8877f9..27ab286 100644 (file)
@@ -327,7 +327,9 @@ L</Modules and Pragmata>.
 
 =item *
 
-XXX
+C<\w> now matches the code points U+200C (ZERO WIDTH NON-JOINER) and
+U+200D (ZERO WIDTH JOINER).  C<\W> no longer matches these.  This change
+is because Unicode corrected their definition of what C<\w> should match.
 
 =back
 
index 3d28155..9fa374e 100644 (file)
@@ -1696,4 +1696,9 @@ ab[c\\\](??{"x"})]{3}d    ab\\](d y       -       -
 (?a:\p{Any})   \x{100} y       $&      \x{100}
 (?aa:\p{Any})  \x{100} y       $&      \x{100}
 
+\w     \x{200C}        y       $&      \x{200C}
+\W     \x{200C}        n       -       -
+\w     \x{200D}        y       $&      \x{200D}
+\W     \x{200D}        n       -       -
+
 # vim: softtabstop=0 noexpandtab