Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Exception from a character class (user defined character properties \p{IsUserDefined} sub IsUserDefined )

by Anonymous Monk
on May 30, 2013 at 20:53 UTC ( #1036140=note: print w/ replies, xml ) Need Help??


in reply to Exception from a character class

perlunicode#User Defined Character Properties

#!/usr/bin/perl -- use strict; use warnings; use Data::Dump; Main( @ARGV ); exit( 0 ); sub Main { my $wa = "'I' am with \x{2018}two\x{2018} kinds of quotes"; my $wi = $wa; my $subs = int $wi =~ s{\p{Punct}}{-}g ; dd [ 'Punct ', $subs, $wa, $wi ]; $wi = $wa; $subs = int $wi =~ s{\p{InPunctNoApostrophe}}{-}g ; dd ['InPunctNoApostrophe', $subs, $wa, $wi ]; } sub InPunctNoApostrophe { return join "\n", ,'+utf8::Punct' ## \p{Punct} aka General_Punctuation ,'-2018' ## LEFT SINGLE QUOTATION MARK (U+2018) ,'-2019' ## RIGHT SINGLE QUOTATION MARK (U+2019) ,'-201A' ## SINGLE LOW .'-9 QUOTATION MARK (U+201A) ,'-201B' ## SINGLE HIGH .'-REVERSED .'-9 QUOTATION MA +RK (U+201B) ,'-201C' ## LEFT DOUBLE QUOTATION MARK (U+201C) ,'-201D' ## RIGHT DOUBLE QUOTATION MARK (U+201D) ,'-201E' ## DOUBLE LOW .'-9 QUOTATION MARK (U+201E) ,'-201F' ## DOUBLE HIGH .'-REVERSED .'-9 QUOTATION MA +RK (U+201F) ,'-2039' ## SINGLE LEFT .'-POINTING ANGLE QUOTATION MARK + (U+2039) ,'-203A' ## SINGLE RIGHT .'-POINTING ANGLE QUOTATION MAR +K (U+203A) #~ ,'-0027' ## ascii https://en.wikipedia.org/wiki/Apostrop +he } __END__ [ "Punct ", 4, "'I' am with \x{2018}two\x{2018} kinds of quotes", "-I- am with -two- kinds of quotes", ] [ "InPunctNoApostrophe", 2, "'I' am with \x{2018}two\x{2018} kinds of quotes", "-I- am with \x{2018}two\x{2018} kinds of quotes", ]


Comment on Re: Exception from a character class (user defined character properties \p{IsUserDefined} sub IsUserDefined )
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1036140]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (10)
As of 2014-08-28 15:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (263 votes), past polls