[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-date: Wed, 7 Sep 2005 13:50:30 -0400 -->
- <!--x-from-r13: Yrvgu.Ingfba ng tgev.tngrpu.rqh (Yrvgu.Ingfba ng tgev.tngrpu.rqh) -->
- <!--x-message-id: E2FFDDCEB278764C9063C344B5A0EC1A7F37BB@APATLITDMAIL01.core.gtri.org -->
- <!--x-subject: [ale] Stripping out crap characters in perl -->
- <li><em>date</em>: Wed, 7 Sep 2005 13:50:30 -0400</li>
- <li><em>from</em>: Keith.Watson at gtri.gatech.edu (Keith.Watson at gtri.gatech.edu)</li>
- <li><em>subject</em>: [ale] Stripping out crap characters in perl</li>
Christopher,
As with any thing in Perl there are lots of ways to do it, here's two.
my $buffer;
for (0..255) {
$buffer .= chr ($_);
}
$buffer =~ s/[^\040-\176\12\15]//g;
print ($buffer);
This sets $buffer to all the ASCII characters from 0 to 255.
Then removes any characters that are NOT space to ~ (32 to 126) and not
LF (10) and CR (13). The corollary would be
$buffer =~ s/[\000-\011\013\014\016-\037\177-\377]//g;
This removes characters 0 to 9, 11, 12, 14 to 31, 127 to 255.
keith
--
Keith R. Watson GTRI/ISD
Systems Support Specialist III Georgia Tech Research Institute
keith.watson at gtri.gatech.edu Atlanta, GA 30332-0816
404-894-0836
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00184" href="msg00184.html">[ale] Stripping out crap characters in perl</a></strong>
<ul><li><em>From:</em> stephen at bee.net (Stephen Cristol)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00178.html">[ale] Colo NE Metro Atlanta?</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00180.html">[ale] TB in an external firewire drive</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00172.html">[ale] Stripping out crap characters in perl</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00184.html">[ale] Stripping out crap characters in perl</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00179"><strong>Date</strong></a></li>
<li><a href="threads.html#00179"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>