title: regex replace '...' at the end of the string
body: <p>I have a string like:</p>
  
  <pre><code>text1 = 'python...is...fun...'
  </code></pre>
  
  <p>I want to replace the multiple '.'s to one '.' only when they are at the end of the string, i want the output to be:</p>
  
  <pre><code>python...is...fun.
  </code></pre>
  
  <p>So when there is only one '.' at the end of the string, then it won't be replaced</p>
  
  <pre><code>text2 = 'python...is...fun.'
  </code></pre>
  
  <p>and the output is just the same as text2</p>
  
  <p>My regex is like this:</p>
  
  <pre><code>text = re.sub(r'(.*)\.{2,}$', r'\1.', text)
  </code></pre>
  
  <p>which i want to match any string then {2 to n} of '.' at the end of the string, but the output is:</p>
  
  <pre><code>python...is...fun..
  </code></pre>
  
  <p>any ideas how to do this?
  Thx in advance!</p>