Re: regular expressions use

2005-08-22 Thread Fredrik Lundh
"max(01)*" <[EMAIL PROTECTED]> wrote: > i would like to do some uri-decoding, which means to translate patterns > like "%2b/dhg-%3b %7E" into "+/dhg-; ~" >>> import urllib >>> urllib.unquote("%2b/dhg-%3b %7E") '+/dhg-; ~' -- http://mail.python.org/mailman/listinfo/python-list

Re: regular expressions use

2005-08-22 Thread Paul McGuire
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( "%"

Re: regular expressions use

2005-08-22 Thread Peter Otten
max(01)* wrote: > would like to do some uri-decoding, which means to translate patterns > like "%2b/dhg-%3b %7E" into "+/dhg-; ~": in practice, if a sequence like > "%2b" is found, it should be translated into one character whose hex > ascii code is 2b. > > i did this: > > ... > import re > imp

regular expressions use

2005-08-22 Thread max(01)*
hi everyone. i would like to do some uri-decoding, which means to translate patterns like "%2b/dhg-%3b %7E" into "+/dhg-; ~": in practice, if a sequence like "%2b" is found, it should be translated into one character whose hex ascii code is 2b. i did this: ... import re import sys modello =