title: Regex to match values between substrings where the middle values are all the same character
body: <p>I'm trying to standardise a set of text files that contain a list of values separated by pipes (&quot;|&quot;) which currently have varying decimal places for values with trailing zeros.</p>
  <p>This seems like something that a regex should be able to handle but I'm struggling with where to start. I've found examples where I can replace any values between two sets of substrings, but not an example where it only matches when the values between are all the same character.</p>
  <p>The Python code below shows a minimal example of what I'm trying to achieve (where the assert should pass if the replacement is successful). Any help would be much appreciated.</p>
  <pre><code>import re
  
  str_in = '4|5|0.00000000|'
  expected_str_out = '4|5|0.0|'
  
  str_out = re.sub('0.(.*?)\|', '0.0|', s)
  assert str_out == expected_str_out
  </code></pre>