Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Answer: How do I remove control characters?

by tachyon (Chancellor)
on May 08, 2002 at 08:52 UTC ( #164953=categorized answer: print w/replies, xml ) Need Help??

Q&A > regular expressions > How do I remove control characters? - Answer contributed by tachyon

tr/// is better but all you needed to make your pseudocode real perl code was:

s/[^\040-\176]/ /g

Note that the control chars are \000 - \037 so these are perhaps more direct:

tr/\000-\037/ /; # best option for speed s/[\000-\037]/ /g # but this still works

Note chr 32 dec 040 octal is the space so you were double spacing your spaces by starting at \041

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[shmem]: afair in SAP that occurs all the time
[shmem]: afair in SAP that sort of indirection is sprinkled all over the database (for hysterical raisins)

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2017-05-25 13:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?