Re: [Tutor] Regular expression grouping insert thingy

2010-06-08 Thread Lang Hurst
Oh. Crap, I knew it would be something simple, but honestly, I don't think that I would have gotten there. Thank you so much. Seriously saved me more grey hair. Matthew Wood wrote: re.sub(r'(\d+)x', r'\1*x', input_text) -- I enjoy haiku but sometimes they don't make sense; refrigerator?

Re: [Tutor] Regular expression grouping insert thingy

2010-06-08 Thread Matthew Wood
re.sub(r'(\d+)x', r'\1*x', input_text) -- I enjoy haiku but sometimes they don't make sense; refrigerator? On Tue, Jun 8, 2010 at 10:11 PM, Lang Hurst wrote: > This is so trivial (or should be), but I can't figure it out. > > I'm trying to do what in vim is > > :s/\([0-9]\)x/\1*x/ > > That is

[Tutor] Regular expression grouping insert thingy

2010-06-08 Thread Lang Hurst
This is so trivial (or should be), but I can't figure it out. I'm trying to do what in vim is :s/\([0-9]\)x/\1*x/ That is, "find a number followed by an x and put a "*" in between the number and the x" So, if the string is "6443x - 3", I'll get back "6443*x - 3" I won't write down all the t