Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Regexp \N{name}

by cjb (Friar)
on Feb 03, 2011 at 10:38 UTC ( #885960=note: print w/ replies, xml ) Need Help??


in reply to Re: Regexp \N{name} (use of \e)

#!/opt/perl/bin/perl use strict; use warnings; use charnames ':full'; binmode STDOUT, ":utf8"; my $string = ':)'; print "$string becomes: "; $string =~ s/:\)/\N{WHITE SMILING FACE}/; print "$string\n$string becomes: "; $string =~ s/\N{WHITE SMILING FACE}/\N{BLACK SMILING FACE}/; print "$string\n$string becomes: "; $string =~s/\N{BLACK SMILING FACE}/:\)/; print "$string\n";

That should cover most uses of \N{CHARNAME}.

charnames and perlre are the best references.

Update: added #! to example


Comment on Re: Regexp \N{name}
Download Code
use of \e
by gautam_9jan on Feb 03, 2011 at 19:14 UTC
    Thank you for your reply please can you tell me why you used binmode STDOUT, ":utf8"; please reply me as soon as possible.........
      Check out perlunicode, <STDOUT> is just a file handle so a belts and braces approach to ensure that it was displaying the unicode characters correctly.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2015-07-04 10:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (59 votes), past polls