praveen vejandla wrote:
> hi all,
> 
> is it possible to replace all special characters in a string with their 
> hex codes using regular expressions.?

Something like:

s/([^;\/?:@&=+\$,A-Za-z0-9\-_.!~*'() ])/sprintf("%02X",ord($1))/eg;

You can use groups of chars like \x00-\x1f and \x7f-\xff in there too.

-- 
   ,-/-  __      _  _         $Bill Luebkert   ICQ=162126130
  (_/   /  )    // //       DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/

_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to