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>Though you are asking for a regular expression, a better solution would be to use <a href="https://docs.python.org/2/library/stdtypes.html#str.split" rel="nofollow"><code>str.split</code></a>, assuming that your string will always be in the format <code>{number} {number} {hyperlink}</code>.</p>

<p>As @godaygo <a href="http://stackoverflow.com/questions/39582859/python-regex-remove-numbers-and-numbers-with-punctaution#comment66476693_39582859">said</a>, you can use this:</p>

<pre><code>line = line.split()[-1]
</code></pre>

<p>The string will be split on whitespace, and we select the last substring.</p>

<p>If you want to access all parts (assuming there's always three), you can use this instead:</p>

<pre><code>num1, num2, url = line.split()
</code></pre>

python regex