Python parse email address with regex
<p>I'm a beginner on regex of python</p>

<p>target <code>test.php</code> code:</p>

<pre><code>&lt;html&gt;
  &lt;head&gt;&lt;/head&gt; 
  &lt;body&gt;
    &lt;a href="www.google.com"&gt;josn2051@yahoo.com.tw&lt;/a&gt;
    &lt;div&gt;john@yahoo.com.tw&lt;/div&gt;
    testtest321@gmail.com
    chorm3636@test.test.test.com
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>This is my code:</p>

<pre><code>import requests,re

email_pattern = re.compile('([\w\-\.]+@(\w[\w\-]+\.)+[\w\-]+)')

res = requests.get("http://127.0.0.1/test.php")

a = email_pattern.findall(res.text)

print a
</code></pre>

<p>The result :</p>

<blockquote>
  <p>[(u'josn2051@yahoo.com.tw', u'com.'), (u'john@yahoo.com.tw', u'com.'),
  (u'asdfFGw@gmail.com', u'gmail.'), (u'chorm3636@test.test.test.com',
  u'test.')]</p>
</blockquote>

<p>But I want the result like:</p>

<blockquote>
  <p>[josn2051@yahoo.com.us,  john@yahoo.com.us, testtest321@gmail.com, chorm3636@test.test.test.com]</p>
</blockquote>

<p>What wrong in my pattern or code ?</p>

<p>Why the result is multiple list containse extra <code>com</code> , <code>gmail</code> , <code>test</code> ?</p>

<p>Thank you solve my doubts !</p>