in reply to Re: regular expression help
in thread regular expression help
but the problem is the logfile is a bit dynamic and i dont know what errors i am going to get. i just know that "--" usually indicates an error but not all lines with "--" means that they are really errors. so in this sample log file:$regex = qr/--/ if($thestring =~ $regex || $thestring !~ $regex) { unshift(@match, $thestring); }
i just want to get081407 start up server 081407 -- fatal error in procedure 1 081407 -- disconnected user 081407 -- logging started 081407 -- not enough space
and disregard the rest like:081407 -- fatal error in procedure 1 081407 -- not enough space
is there a way i can use it in qr// function? i guess something like this:081407 -- disconnected user 081407 -- logging started
hope thats clearer1. get all occurrences of "--". 2. in those occurrences of "--" ignore those that have "logging" and " +disconnected" could it be place in a qr// function like: qr/-- || ~! logging,disconnected/ (wrong syntax of course) something like an ignore list.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: regular expression help
by FunkyMonk (Bishop) on Aug 14, 2007 at 18:37 UTC |