import re

def RECheckingDomain():
    url = open('url.txt', 'r')
    content = url.read()
    #print "@@@" + content + "111"

    # ((http://|https://)?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})
    reString = '(http://|https://)?([a-zA-Z0-9][a-zA-Z0-9\_\-]{1,62}\.)+[a-zA-Z\-]{2,}'# + ([^a-zA-Z0-9/\.]|\n|$)'
    # reString = '/^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}$/'
    reobj = re.compile(reString, re.IGNORECASE | re.MULTILINE)
    m = reobj.finditer(content)
    for i in m:
        print i.group()
    # domainListFile = open('domainList.txt', 'r')
    # for domain in domainListFile:
    #     domain = domain.rstrip()
    #     #print "___" + domain + "___"
    #     reString = '(http://|https://)?[a-zA-Z0-9_\.]+\.' + domain + '([^a-zA-Z0-9/\.]|\n|$)'
    #     reobj = re.compile(reString, re.IGNORECASE | re.MULTILINE)
    #     m = reobj.finditer(content)
    #     for i in m:
    #         print i.group()

if __name__ == '__main__':
    RECheckingDomain()