Python Regex remove numbers and numbers with punctaution
<p>I have the following string</p>

<pre><code> line = "1234567 7852853427.111 https://en.wikipedia.org/wiki/Dictionary_(disambiguation)"
</code></pre>

<p>I would like to remove the numbers 1234567 7852853427.111 using regular expresisions</p>

<p>I have this re
    nline = re.sub("^\d+\s|\s\d+\s|\s\d\w\d|\s\d+$", " ", line)</p>

<p>but it is not doing what i hoped it would be doing.</p>

<p>Can anyone point me in the right direction?</p>

<p>You can use:</p>

<pre><code>&gt;&gt;&gt; line = "1234567 7852853427.111 https://en.wikipedia.org/wiki/Dictionary_(disambiguation)" 
&gt;&gt;&gt; print re.sub(r'\b\d+(?:\.\d+)?\s+', '', line)

https://en.wikipedia.org/wiki/Dictionary_(disambiguation)
</code></pre>

<p>Regex <code>\b\d+(?:\.\d+)?\s+</code> will match an integer or decimal number followed by 1 or more spaces. <code>\b</code> is for word boundary.</p>

python regex