regular expression does not replace hyphens with dots
<p>For the following text:</p>

<pre><code>comment = """ I took the pill -  I realized only side-effect after I went off it how it affected my eating habits - I put on weight - around 10 lbs - in the 2.5 months on it - no control and syndrome - this was counterproductive !"""
</code></pre>

<p>I wrote regular expression to <code>replace hyphen (-) with dot (.)</code></p>

<pre><code>comment = re.sub (r'(w+\s+)(-)(\s+\w+)', r'\1\. \3 ', comment )
</code></pre>

<p>But it does not work.</p>

<p>I do not want the hyphen between two words such as side-effect replace with dot. 
thats why I cannot use <code>comment.replace ('-', '.')</code></p>

<p>Any Suggestion ?</p>

<p>You could also use the <code>str.replace</code> method</p>

<pre><code>comment.replace('-', '...')
</code></pre>

python regex