Perhaps a bit more verbose than your Perl regexp, here is a decoder using pyparsing.
-- Paul # download pyparsing at http://pyparsing.sourceforge.net from pyparsing import Word,Combine # define grammar for matching encoded characters hexnums = "0123456789ABCDEFabcdef" encodedChar = Combine( "%" + Word(hexnums,exact=2) ) # define and attach conversion action def unencode(s,l,toks): return chr(int(toks[0][1:],16)) encodedChar.setParseAction( unencode ) # transform test string data = "%2b/dhg-%3b %7E" print encodedChar.transformString( data ) """ Prints "+/dhg-; ~": """ -- http://mail.python.org/mailman/listinfo/python-list