Nov-14-2021, 09:11 PM
Just a small change to read the file into an array; works fine.
import re # read file into an array f = open('https.txt', 'r+') data = f.read() f.close() pattern = re.compile(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+') for match in pattern.finditer(data): print(match.group())Thanks everyone for your help.
