gwadej's suggestion of
Apache::LogRegex might fit your bill - I scanned the documentation and it's probably worth a few minutes of effort. Barring that, it might be worth it to incrementally add characters to your match expression (probably while doing some of the suggested reformatting) until the match fails.