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

Answer:

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

(required)

(required)

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>