You selected the correct regexp, you just have to quote it to use it in Python. You also need to call
re.findall(), it’s not a string method.
import re txt = 'I refer to https://google.com and i never refer http://www.baidu.com' print(re.findall(r'(?<=https:\/\/)([A-Za-z0-9.]*)', txt))
CLICK HERE to find out more related problems solutions.