I'm parsing some logs and want to extract all parameter names of a certain type. For simplicity, I'll just include a small substring.
log = 'WT.tz=-8&WT.bh=23&WT.ul=en-US'
#I want to find all strings that start with WT and get WT and all the following characters until I find an & or the end of the string. I tested this on an online regex page and it seems to work great.
regex = r'(?s)(?=WT).+?(?=(=))'
# if I try to find the first I get what I expected
re.search(regex,log).group()
>> 'WT.tz'
#when I try to find all I do not get what I thought I was going to get.
re.findall(regex,log)
>> ['=','=','=']