I'm trying to match patterns of the types
sentence1 = "keywords=walter&keywords=scott"
sentence2 = "keywords=john&"
sentence3 = "keywords=james&keywords=john&keywords=brian&"
so basically the keywords=somestring& part can be repeated once or multiple times. I am trying to extract the string(s) between '=' and '&'. I have come up with the following so far.
pattern = re.compile(r"(keywords=[A-Z0-9._%+-]+[&])+",re.IGNORECASE)
This says it matches the 3rd sentence containing multiple "keywords=" but does not give me the three matches.
gives me ('keywords=scott&') and not the other two keywords present in it.
What am I doing wrong?