Fixed parsing of \" in "".

This commit is contained in:
Christian P. MOMON 2024-07-20 14:55:12 +02:00
parent 030f895c5c
commit 439f0b3671

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org> * Copyright (C) 2021-2024 Christian Pierre MOMON <christian@momon.org>
* *
* This file is part of Logar, simple tool to manage http log files. * This file is part of Logar, simple tool to manage http log files.
* *
@ -39,7 +39,7 @@ public final class AccessLogParser implements LineParser
private static Logger logger = LoggerFactory.getLogger(AccessLogParser.class); private static Logger logger = LoggerFactory.getLogger(AccessLogParser.class);
public static Pattern COMBINED_ACCESSLOG_LINE_PATTERN = Pattern.compile( public static Pattern COMBINED_ACCESSLOG_LINE_PATTERN = Pattern.compile(
"^(?<remoteAddress>[a-zA-F0-9\\\\:\\\\.]+) - (?<remoteUser>[^\\[]+) \\[(?<datetime>[^\\]]+)\\] \"(?<request>[^\"]*)\" (?<status>\\d+) (?<bodyBytesSent>\\d+) \"(?<referer>[^\"]*)\" \"(?<userAgent>[^\"]*)\".*$"); "^(?<remoteAddress>[a-zA-F0-9\\\\:\\\\.]+) - (?<remoteUser>[^\\[]+) \\[(?<datetime>[^\\]]+)\\] \"(?<request>([^\"]|\\\")*)\" (?<status>\\d+) (?<bodyBytesSent>\\d+) \"(?<referer>([^\"]|\\\")*)\" \"(?<userAgent>([^\"]|\\\")*)\".*$");
/** /**
* Instantiates a new log parser. * Instantiates a new log parser.