First time working with Python Regex and I just need a little tip on matching strings.
I have a url like this: url = "https://www.youtube.com/api/timedtext?xorp=True&xoaf=1&v=UloIw7dhnlQ&signature=C2AF3C2887A37043353A86AAAACFA796659B56CB.E736B7146447843F2D3311234744DC0D9937AF7B&asr_langs=fr%2Cru%2Ces%2Cnl%2Cit%2Cde%2Cko%2Cen%2Cpt%2Cja&sparams=asr_langs%2Ccaps%2Cv%2Cxoaf%2Cxorp%2Cexpire&expire=1541769991&key=yttt1hl=&encaps=asrlang=enfmt=srv3"
I am trying to match everything except the part that begins with expire=1541769991 (2nd to last line). This is what I have come up with:
matchObj = re.match( r'(.*)expire=(.*)&(.*?)', url)
The problem is the third group includes the text after the last occurrence of &. I want the text following the first occurrence of & after expire=. I tried adding a ? after & to make it non-greedy too. How would I go about doing this?