develooper Front page | perl.perl5.porters | Postings from July 2013

[perl #118667] doc and code mismatch on some space character( classe)s

Thread Previous
Steffen "Daode" Nurpmeso
July 2, 2013 17:21
[perl #118667] doc and code mismatch on some space character( classe)s
Message ID:
# New Ticket Created by  Steffen "Daode" Nurpmeso 
# Please include the string:  [perl #118667]
# in the subject line of all future correspondence about this issue. 
# <URL: >

there is something i don't understand.  Thank you.

  $ perl -e 'print "$^V:";$i="\x{00A0}"'\
      -e ';if($i=~/[[:space:]]/){print "1"}'\
      -e ';if($i=~/\s/){print "2"}'\
      -e ';if($i=~/\p{IsSpace}/){print "3"}'\
      -e ';print "\n"'
    :3 <- 5.8.9 (-))

Also in respect to a doc mismatch in 5.10.0, 5.16.1 and still in
5.18.0 (perlre manual):

  The following equivalences to Unicode \p{} constructs and
  equivalent backslash character classes (if available), will
  space       IsSpace
              IsSpacePerl    \s
  You can negate the [::] character classes by prefixing the class
  name with a '^'. This is a Perl extension.  For example:
  [[:^space:]]    \S         \P{IsSpace}

Also note that `Z' includes `Zl' (U+2028) and `Zp' (U+2029), so
that the following from the perlretut manual i don't understand:

  Perl class name  Unicode class name or regular expression
  IsSpace          /^Z/ || ($code =~ /^(0009|000A|000B|000C|000D)$/
  IsSpacePerl      /^Z/ || ($code =~ /^(0009|000A|000C|000D|0085|2028|2029)$/


Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About