Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jul 262010

Replace Unicode character using regex with Perl


To use regex to replace Perl's Unicode string, you can try the following.

$text =~ s/[\x{0000}-\x{007F}]+/ /g;

The above code replace all Unicode with codepoint from 0 to 127 by a space.

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>