re.sub(r'(\d+)x', r'\1*x', input_text)<br clear="all"><br>--<br><br>I enjoy haiku<br>but sometimes they don't make sense;<br>refrigerator?<br>
<br><br><div class="gmail_quote">On Tue, Jun 8, 2010 at 10:11 PM, Lang Hurst <span dir="ltr"><<a href="mailto:lang@tharin.com">lang@tharin.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
This is so trivial (or should be), but I can't figure it out.<br>
<br>
I'm trying to do what in vim is<br>
<br>
:s/\([0-9]\)x/\1*x/<br>
<br>
That is, "find a number followed by an x and put a "*" in between the number and the x"<br>
<br>
So, if the string is "6443x - 3", I'll get back "6443*x - 3"<br>
<br>
I won't write down all the things I've tried, but suffice it to say, nothing has done it. I just found myself figuring out how to call sed and realized that this should be a one-liner in python too. Any ideas? I've read a lot of documentation, but I just can't figure it out. Thanks.<br>
<font color="#888888">
<br>
-- <br>
There are no stupid questions, just stupid people.<br>
<br>
_______________________________________________<br>
Tutor maillist - <a href="mailto:Tutor@python.org" target="_blank">Tutor@python.org</a><br>
To unsubscribe or change subscription options:<br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
</font></blockquote></div><br>