How can i solve this regular expression, Python?
<p>I would like to construct a reg expression pattern for the following string, and use Python to extract:</p>

<pre><code>str = "hello w0rld how 34 ar3 44 you\n welcome 200 stack000verflow\n"
</code></pre>

<p>What I want to do is extract the <strong>independent</strong> number values and add them which should be 278. A prelimenary python code is:</p>

<pre><code>import re
x = re.findall('([0-9]+)', str)
</code></pre>

<p>The problem with the above code is that numbers within a char substring like 'ar3' would show up. Any idea how to solve this?</p>

<p>Why not try something simpler like this?: </p>

<pre><code>str = "hello w0rld how 34 ar3 44 you\n welcome 200 stack000verflow\n"
print sum([int(s) for s in str.split() if s.isdigit()])
# 278
</code></pre>

python regex