re.findall not finding all, only some. How could this be? : <p>I have a text file containing five websites. In each of these websites are multiple amazon links, in which my goal is to collect all of them. However, one of the five websites uses "amzn.to" to lead to the amazon link instead of "amazon.com", which I initially thought was solvable by just using this:</p>

<pre><code>any(re.findall(r'(amazon.com|amzn.to)', str, re.IGNORECASE))
</code></pre>

<p>There's supposed to be ten <code>amzn.to</code> links included in my overall list of amazon links but only two are found.</p>

<p>Here's my entire code:</p>

<pre><code>import requests
import re
from bs4 import BeautifulSoup
from collections import OrderedDict

file_name = raw_input("Enter file name: ")
filepath = "%s"%(file_name)

with open(filepath) as f:
    listoflinks = [line.rstrip('\n') for line in f]

raw_links = []
for i in listoflinks:
    html = requests.get(i).text
    bs = BeautifulSoup(html)
    possible_links = bs.find_all('a')
    for link in possible_links:
        if link.has_attr('href'):
            raw_links.append(link.attrs['href'])

amazon_links = []
for str in raw_links:
    if (any(re.findall(r'(amazon.com|amzn.to)', str, re.IGNORECASE))) and (str not in amazon_links):
        amazon_links.append(str)

for i in amazon_links:
    print i
print len(amazon_links)
</code></pre>

<p>I know it works, but not as well as I'd like it to. Please help me pinpoint the problem.</p>
