Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Excluding non ascii characters

by linuxer (Curate)
on Apr 06, 2009 at 19:07 UTC ( #755821=note: print w/replies, xml ) Need Help??


in reply to Excluding non ascii characters

What about a character range? And if you want to delete those characters, you also can use tr///.

$myline =~ tr/\x80-\xff//d;

or if you want to stick to s///.

$myline =~ s/[\x80-\xff]/ /g;

Replies are listed 'Best First'.
Re^2: Excluding non ascii characters
by ikegami (Pope) on Apr 06, 2009 at 19:32 UTC
    That will only remove the non-ASCII characters that are in iso-latin-1, a very small portion of non-ASCII characters. Fix:
    # Replace with space $myline =~ s/[^\x00-\x7F]/ /g; # Delete character $myline =~ tr/\x00-\x7F//cd; $myline =~ s/[^\x00-\x7F]//g;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://755821]
help
Chatterbox?
[marto]: no
[marto]: that is to say, to the best of my knowledge, they never did.
[marto]: they have a commercial product called perlapp
[mark4]: Do you h=know how I can get pp.exe? Is there a module I can install that includes this?
[marto]: I always found Strawberry Perl on windows to be a much better environment, made life much easier
[marto]: pp. install it like you would any other module
[marto]: it probably exists in one of the PPM repositories

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2018-01-19 14:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (218 votes). Check out past polls.

    Notices?