Regex for nginx log parser
At the very least, use verbose mode so you can see the whole thing at once.  Remember to explicitly include whitespace.

lineformat = re.compile(r"""
   (?P&lt;ipaddress&gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+
   -\s+
   -\s+
   \[(?P&lt;dateandtime&gt;\d{2}\/[a-z]{3}\/\d{4}:\d{2}:\d{2}:\d{2} (\+|\-)\d{4})\]\s+
   \"GET (?P&lt;url&gt;.+?(?=\ http\/1.1")) http\/1.1"\s+
   \d{3}\s+
   \d+\s+
   "-"\s+
   (?P&lt;http_user_agent&gt;.+?(?=\ ))\s+
   "-"\s+
   "(?P&lt;x_forwaded_for&gt;(.+?))"\s+
   "(?P&lt;http_xb_user&gt;(.+?))"\s+
   (?P&lt;request_time&gt;[+-]?([0-9]*[.])?[0-9]+)
   """,
   re.IGNORECASE | re.VERBOSE)