Re: using re module to find " but not " alone ... is this a BUG in re?

2008-06-13 Thread Paul McGuire
On Jun 12, 4:11 am, anton <[EMAIL PROTECTED]> wrote: > Hi, > > I want to replace all occourences of " by \" in a string. > > But I want to leave all occourences of \" as they are. > > The following should happen: > >   this I want " while I dont want this \" > > should be transformed to: > >   this

Re: using re module to find

2008-06-13 Thread John Machin
On Jun 13, 6:23 pm, anton <[EMAIL PROTECTED]> wrote: > John Machin lexicon.net> writes: > > > > > On Jun 12, 7:11 pm, anton <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > I want to replace all occourences of " by \" in a string. > > > > But I want to leave all occourences of \" as they are. > > > >

Re: using re module to find

2008-06-13 Thread anton
John Machin lexicon.net> writes: > > On Jun 12, 7:11 pm, anton <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I want to replace all occourences of " by \" in a string. > > > > But I want to leave all occourences of \" as they are. > > > > The following should happen: > > > > this I want " while I

Re: using re module to find " but not " alone ... is this a BUG in re?

2008-06-12 Thread Peter Otten
anton wrote: > I want to replace all occourences of " by \" in a string. > > But I want to leave all occourences of \" as they are. > > The following should happen: > > this I want " while I dont want this \" > > should be transformed to: > > this I want \" while I dont want this \" > >

Re: using re module to find " but not " alone ... is this a BUG in re?

2008-06-12 Thread Duncan Booth
John Machin <[EMAIL PROTECTED]> wrote: > What you want is: > >>> import re >>> text = r'frob this " avoid this \", OK?' text > 'frob this " avoid this \\", OK?' >>> re.sub(r'(? frob this \\" avoid this \\", OK?' >>> > Or you can do it without using regular expressions at all. Just replace

Re: using re module to find " but not " alone ... is this a BUG in re?

2008-06-12 Thread John Machin
On Jun 12, 7:11 pm, anton <[EMAIL PROTECTED]> wrote: > Hi, > > I want to replace all occourences of " by \" in a string. > > But I want to leave all occourences of \" as they are. > > The following should happen: > > this I want " while I dont want this \" > > should be transformed to: > > this