note 35802 added to function.preg-match
| From: | sbechtold at spoerle dot com | Date: | Mon, 15 Sep 2003 11:49:21 +0000 |
| Subject: | note 35802 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-56519@lists.php.net to get a copy of this message | ||
Can anybody help me with this here:
i've got lines from the webalizer logfile and i want to split it using preg_match for each
line.
the lines are like this:
12.15.44.57 - - [30/Jun/2003:23:34:24 +0200] "GET /text.css HTTP/1.1" 200 2528
104.15.52.52 - - [30/Jun/2003:23:34:24 +0200] "GET /images/buttongruenmitc.gif HTTP/1.1"
200 1656
103.214.154.9 - - [30/Jun/2003:23:34:24 +0200] "GET /images/buttongruenwissenc.gif
HTTP/1.1" 200 1643
The pattern i have created is like this:
/^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}) - - \[
([0-9]{2})\/([a-zA-Z]{3})\/([0-9]{4}):([0-9]{2}):([0-9]{2}):
([0-9]{2}) ([+-]{1}[0-9]{4})\] "(POST|GET){1} (.*?)
(HTTP/[0-9]{1,}\.[0-9]{1,})" ([0-9]{1,}) ([0-9]{1,})$/
But it's throwing an error:
Unknown modifier '[' in /www/admin/logs/test.php on line 5
who can help me with this problem?
thanks for any quotes, also via email
----
Manual Page -- http://www.php.net/manual/en/function.preg-match.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35802
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35802&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35802&report=yes