i have a string like this:
to_search = "example <a>first</a> asdqwe <a>second</a>"
and i want to find both solutions between like this:
list = ["first","second"]
i know that when searching for one solution i should use this code:
import re
if to_search.find("<a>") > -1:
result = re.search('<a>(.*?)</a>', to_search)
s = result.group(1)
print(s)
but that only prints:
first
i tried result.group(2) and result.group(0) but i get the same solution
how can i make a list of all solutions?