re.sub(r&#39;(\d+)x&#39;, r&#39;\1*x&#39;, input_text)<br clear="all"><br>--<br><br>I enjoy haiku<br>but sometimes they don&#39;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">&lt;<a href="mailto:lang@tharin.com">lang@tharin.com</a>&gt;</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&#39;t figure it out.<br>
<br>
I&#39;m trying to do what in vim is<br>
<br>
:s/\([0-9]\)x/\1*x/<br>
<br>
That is, &quot;find a number followed by an x and put a &quot;*&quot; in between the number and the x&quot;<br>
<br>
So, if the string is &quot;6443x - 3&quot;, I&#39;ll get back &quot;6443*x - 3&quot;<br>
<br>
I won&#39;t write down all the things I&#39;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&#39;ve read a lot of documentation, but I just can&#39;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>