> Take for example:
>
> 194.236.30.24 - - [30/Aug/2002:11:46:29 +0200] "GET
> /bildgalleri/createjpg.php?url=/v044&file=v044_27.jpg HTTP/1.1" 200
> 8874
> 217.215.84.222 - - [30/Aug/2002:11:46:39 +0200] "POST /weblogg.php
> HTTP/1.1" 200 3149488

[more loglines]

>
> Here I'ld like to remove all lines that looks like 217.215.84.222 some
> text ending with line break…
>
> How should the reg exp look?

Try this: preg_replace( "/^217.215.84.222.*\n/m", "", $log )
The second argument, currently empty, can be used as a replacement string.

As we look at the regular expression "/^217.215.84.222.*\n/m", from left to
right:
^ Start of line if modifier /m is used (completely right)
<ip address>, followed by a dot (.). This dot means any characters, followed
by a asterisk (*). The asterisk is a "0 or more quantifier", which matched
everything until the next statement (in this case the "\n").

You can also use "$" instead of "\n", only the newline will not be stripped.
"$" means end of line, while "\n" means newline.

HTH, Erwin



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to