in reply to Crafting a regex

I guess there is no generic way to grab reliably the location part as it can include quotes, quotes followed by spaces, HTTP codes...
So the answer is probably to grab the rest, which has a fixed format and then consider the location to be anything else:

m/^\d+\d+\d+\d+ [\w-]+ [\w-]+ \[[^\]]+] [^\s]+ ".*" HTTP\/1.[01] \d{3} \d+$/

This would make sure you match everything properly, and the .* part has no choice but to match the location string

Add brackets to taste to catch what you are interested in

Replies are listed 'Best First'.
RE: Re: Crafting a regex
by mirod (Canon) on Oct 11, 2000 at 21:28 UTC

    Hey, the dots disappeared, it should be:

    m/^\d+\.\d+\.\d+\.\d+ [\w-]+ [\w-]+ \[[^\]]+] [^\s]+ ".*" HTTP\/1.[01] \d{3} \d+$/

    of course!