rendered paste body======== AVANT =========
# String like "abc" or "a\"bc" or just ""
match_quoted_string = r"\"((?:[^\"]|\\\")*)\""
# Regex matching one line
regex = r"^([^ ]+) " # Origin
regex += r"([^ ]+) " # Host
regex += r"([a-z]+|-) " # User
regex += r"\[([^]]+)\] " # Date
regex += r"\"(POST|GET|HEAD) ([^ ]+) HTTP/1\.[01]\" " # Method, Url
regex += r"([0-9]{3}) ([0-9]+|-) " # Code, Size
regex += match_quoted_string+" " # Referrer
regex += match_quoted_string+"$" # Browser string
=============== APRES ===========
# String like "abc" or "a\"bc" or just ""
match_quoted_string = r"\"((?:[^\"]|\\\")*)\""
replace = {
"origin": r"([^ ]+)",
"host": r"([^ ]+)",
"user": r"([a-z]+|-)",
"date": r"\[([^]]+)\]",
"request": r"\"(POST|GET|HEAD) ([^ ]+) HTTP/1\.[01]\"",
"answer": r"([0-9]{3}) ([0-9]+|-)",
"referrer": match_quoted_string,
"browser": match_quoted_string,
}
regex = "^%(origin)s %(host)s %(user)s %(date)s %(request)s %(answer)s %(referrer)s %(browser)s$" % replace