title: Regex match on multiple overlapping occurrences?
body: <p>I have strings that look like:</p>
  
  <pre><code>sometext 3x 24x5 x 17.5 x 3 sometext
  </code></pre>
  
  <p>And I would like to concatenate all instances of digit + optional space + x + optional space + digit into digit + x + digit. Desired output:</p>
  
  <pre><code>sometext 3x24x5x17.5x3 sometext
  </code></pre>
  
  <p>My current Regex seems fine, but somehow it doesn't work:</p>
  
  <pre><code>re.sub(r'(\d)\s?([x])\s?(\d)', r'\1\2\3', 'sometext 3x 24x5 x 17.5 x 3 sometext')
  </code></pre>
  
  <p>Yields</p>
  
  <pre><code>sometext 3x24x5 x 17.5x3 sometext
  </code></pre>
  
  <p>It seems this has to do with the fact that the 24x5 is already captured by the expression, so it doesn't consider 5 x 17. My question would be, how to adjust my regex for the desired purpose, and, is there any more clean/efficient way to write that regex than my approach? Thanks!</p>