I have to find strings that starts from var actual = " and ends with " in html code My code is working import re s = """ some htmlcode var actual = "https://url1.com" var actual = "https://url2.com" """ compiled = re.compile(r'var actual = "(.*)(?=")') match = compiled.findall(s) print(match) What is the optimal way (in terms of time) to solve the problem with python? Continue reading...