Re: [Tutor] Substring substitution

2005-09-09 Thread Bernard Lebel
Hi Kent, Once again, thanks a lot. Problem solved now, your suggestions work like a charm. You were absolutely right about the last group matching. I modified my matching pattern: oRe = re.compile( "(\d\d_\d\d\_)(\d\d(\D|$))" ) Instead of oRe = re.compile( "(\d\d_\d\d\_)(\d\d)" ) I had no ide

Re: [Tutor] Substring substitution

2005-09-08 Thread Kent Johnson
Bernard Lebel wrote: > Ok I think I understand what is going: I'm using a 0 in the > replacement argument, between the two groups. If I try with a letter > or other types of characters it works fine. So how can use a digit > here? There is a longer syntax for \1 - \g<1> means the same thing but wi

Re: [Tutor] Substring substitution

2005-09-08 Thread Bernard Lebel
Ok I think I understand what is going: I'm using a 0 in the replacement argument, between the two groups. If I try with a letter or other types of characters it works fine. So how can use a digit here? Thanks Bernard On 9/8/05, Bernard Lebel <[EMAIL PROTECTED]> wrote: > Hi Kent, > > This is nic

Re: [Tutor] Substring substitution

2005-09-08 Thread Bernard Lebel
Hi Kent, This is nice! There is one thing though. When I run the oRe.sub() call, I get an error: Traceback (most recent call last): File "", line 1, in ? File "\\Linuxserver\prod\XSI\WORKGROUP_4.0\Data\Scripts\pipeline\filesystem\bb_processshotdigits.py", line 63, in ? processPath( r'C

Re: [Tutor] Substring substitution

2005-09-08 Thread Kent Johnson
Bernard Lebel wrote: > Hello, > > I have a string, and I use a regular expression to search a match in > it. When I find one, I would like to break down the string, using the > matched part of it, to be able to perform some formatting and to later > build a brand new string with the separate parts

[Tutor] Substring substitution

2005-09-08 Thread Bernard Lebel
Hello, I have a string, and I use a regular expression to search a match in it. When I find one, I would like to break down the string, using the matched part of it, to be able to perform some formatting and to later build a brand new string with the separate parts. The regular expression part wo