<gh_stars>0
import re

urls = '''
https://www.google.com
https://www.dazeofthewolf.com
https://youtube.com
https://www.nasa.gov
'''

pattern = re.compile(r'https?://(www\.)?(\w+)(\.\w+)')

subbed_urls = pattern.sub(r'\2\3', urls)

print(subbed_urls)

# matches = pattern.finditer(urls)

# for match in matches:
#     print(match.group(3))

import re

urls = '''
https://www.google.com
https://www.dazeofthewolf.com
https://youtube.com
https://www.nasa.gov
'''

pattern = re.compile(r'https?://(www\.)?(\w+)(\.\w+)')

subbed_urls = pattern.sub(r'\2\3', urls)

print(subbed_urls)

# matches = pattern.finditer(urls)

# for match in matches:
#     print(match.group(3))
https://www.google.com https://www.dazeofthewolf.com https://youtube.com https://www.nasa.gov # matches = pattern.finditer(urls) # for match in matches: #     print(match.group(3))