Re: Using a function for regular expression substitution

2010-08-30 Thread naugiedoggie
On Aug 29, 1:14 pm, MRAB pyt...@mrabarnett.plus.com wrote: On 29/08/2010 15:22, naugiedoggie wrote: I'm having a problem with using a function as the replacement in re.sub(). Here is the function: def normalize(s) :      return

Re: Using a function for regular expression substitution

2010-08-30 Thread naugiedoggie
On Aug 30, 8:52 am, naugiedoggie michael.a.p...@gmail.com wrote: On Aug 29, 1:14 pm, MRAB pyt...@mrabarnett.plus.com wrote: On 29/08/2010 15:22, naugiedoggie wrote: I'm having a problem with using a function as the replacement in re.sub(). Here is the function: def normalize(s)

Using a function for regular expression substitution

2010-08-29 Thread naugiedoggie
Hello, I'm having a problem with using a function as the replacement in re.sub(). Here is the function: def normalize(s) : return urllib.quote(string.capwords(urllib.unquote(s.group('provider' The purpose of this function is to proper-case the words contained in a URL query string

Re: Using a function for regular expression substitution

2010-08-29 Thread Roy Smith
In article 9170aad0-478a-4222-b6e2-88d00899d...@t2g2000yqe.googlegroups.com, naugiedoggie michael.a.p...@gmail.com wrote: Hello, I'm having a problem with using a function as the replacement in re.sub(). Here is the function: def normalize(s) : return

Re: Using a function for regular expression substitution

2010-08-29 Thread Terry Reedy
On 8/29/2010 10:22 AM, naugiedoggie wrote: Hello, I'm having a problem with using a function as the replacement in re.sub(). Here is the function: def normalize(s) : return urllib.quote(string.capwords(urllib.unquote(s.group('provider' To debug your problem, I would start with

Re: Using a function for regular expression substitution

2010-08-29 Thread MRAB
On 29/08/2010 15:22, naugiedoggie wrote: Hello, I'm having a problem with using a function as the replacement in re.sub(). Here is the function: def normalize(s) : return urllib.quote(string.capwords(urllib.unquote(s.group('provider' This normalises the provider and returns only