Delete nonprinting chars

F

fishfry

I know this is in the book but I can't find it at the moment ...

what's the clever way to remove all nonprinting characters from a string?
 
B

Ben Morrow

Quoth fishfry said:
I know this is in the book but I can't find it at the moment ...

what's the clever way to remove all nonprinting characters from a string?

perldoc perlre
perldoc perlop

$string =~ s/[^[:print:]]//g;

Ben
 
J

Jürgen Exner

fishfry said:
I know this is in the book but I can't find it at the moment ...

what's the clever way to remove all nonprinting characters from a
string?

From "perldoc perlre":

The POSIX character class syntax

[:class:]

is also available. The available classes and their backslash equivalents
(if available) are as follows:
[...]
print
[...]

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top