Capturing user agent from Apache Web log file

Q

How to capture the user agent from Apache Web log file?

Here are some Apache Web log file entries:

✍: Guest

A

Apache Web log file entries are written in this format:

host - user time method path protocol status size referer agent cookie

The regular expression to capture user agent from Apache Web log file entries can be written as: with the multiple lines modifier "m" specified:

Click the button to test this regular expression here online:

2013-02-04, 0👍, 0💬