Re: [Tutor] use of variables in re.sub

2013-02-14 Thread Oscar Benjamin
On 14 February 2013 12:57, Eva Bofias wrote: > Helo, Hi, > I need to do a substitution in a regular expression that depends on a > variable. To simplify I want to be able to do this substitution: > > text2='XX. AA YY. DD' > re.sub(ur"\. (AA|BB|ÇÇ","(.) \g<1>",text2) There is a missing bracket i

[Tutor] use of variables in re.sub

2013-02-14 Thread Eva Bofias
Helo, I need to do a substitution in a regular expression that depends on a variable. To simplify I want to be able to do this substitution: text2='XX. AA YY. DD' re.sub(ur"\. (AA|BB|ÇÇ","(.) \g<1>",text2) this would give as a result: 'XX(.) AA YY. DD' Which is exactly what I want. But when I t