Re: replace random matches of regexp

2011-09-08 Thread gry
On Sep 8, 3:51 pm, gry wrote: To elaborate(always give example of desired output...) I would hope to get something like: SELECT public.max(PUBLIC.TT.I) AS SEL_0 FROM (SCHM.T RIGHT OUTER JOIN PUBLIC.TT ON (SCHM.T.I IS NULL)) WHERE (NOT(NOT((power(PUBLIC.TT.F, PUBLIC.TT.F) = cast(ceil(( SEL

Re: replace random matches of regexp

2011-09-08 Thread Peter Otten
gry wrote: > [Python 2.7] > I have a body of text (~1MB) that I need to modify. I need to look > for matches of a regular expression and replace a random selection of > those matches with a new string. There may be several matches on any > line, and a random selection of them should be replaced

Re: replace random matches of regexp

2011-09-08 Thread André Malo
* gry wrote: > I might want to replace '(max|min|cos|sqrt|ceil' with "public.\1", but > only with probability 0.7. I looked and looked for some computed > thing in re's that I could stick and expression, but could not find > such(for good reasons, I know). > Any ideas how to do this? I would go

Re: replace random matches of regexp

2011-09-08 Thread MRAB
On 08/09/2011 20:51, gry wrote: [Python 2.7] I have a body of text (~1MB) that I need to modify. I need to look for matches of a regular expression and replace a random selection of those matches with a new string. There may be several matches on any line, and a random selection of them should

replace random matches of regexp

2011-09-08 Thread gry
[Python 2.7] I have a body of text (~1MB) that I need to modify. I need to look for matches of a regular expression and replace a random selection of those matches with a new string. There may be several matches on any line, and a random selection of them should be replaced. The probability of