I am trying to search through an apache log file in order to pull out lines that do not have certain strings ("session" and "curl") and the lines must have a particular month string ("Dec"). The searches work on their own:
re.search("^((?!session|curl).)*$", f[line])
re.search(r'Dec', f[line])
I am wondering if I can get away with combining them in a single join? I tried this
re.search('|'.join('(?:{0})'.format(x) for x in (r'Dec', r'/^((?!session|curl).)*/$')), f[line])
I am expecting to see lines with the correct month, and to have lines with the strings "session" and "curl" excluded, but instead all the lines are returned.
Please what am I doing wrong?