Re: please advise help with regex
- From: "nobull67@xxxxxxxxx" <nobull67@xxxxxxxxx>
- Date: 28 Sep 2006 13:31:20 -0700
Gregory Machin top posts (please don't):
On 9/28/06, Rob Dixon <rob.dixon@xxxxxxx> wrote:i have been playing... will this work and wich is more efficient ?
28-Sep-2006 10:10:57.266update: info: client 192.168.1.170#33364: view
internal: updating zone 'lan.linserv.co.za/IN': adding an RR at '
greg.lan.linserv.co.za' A"
/^([0-3][0-9]\-
#day -----|
(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+ #month
|
\-(20)[0-9][0-9]\s+
#year till 2099 |
[0-9][0-9]\:
#hour |= date and time
[0-9][0-9]\:
#miniute |
[0-9][0-9]\:)
#hour -----|
((\.\d{3})?
#milliseconds
(\w\:)
#catagory ----- catagory
(\s+\w\:)
#severity ----- serverity
(\w\s+)
#host ----- host
(s+\d+\.\d+\.\d+\.\d+)
#ip ----- ip
(\#\d+/i)
#port ----- port
(\:\s+\s\w\s\w\:) #view
----- view
(\s+[:alpha:]/) #query
----- query
Why are you working so damn hard?
What's with the ---- ?
[0-9] can be written \d every time.
There's no need to escape colons
\w matches a single character \w+ matches a "word".
\S+ will match any seqence of non-whitespace.
Unless you are trying to validate the data you can use a far more
liberal pattern.
my ($date,$time,$catagory,$severity, $host, $ip, $port, $view, $query)
=
/^(\S+) (\S+\.\d+)(\S+): (\S+): (\S+) (\S+)#(\d+): view (\S+):
(.*)/;
.
- References:
- please advise help with regex
- From: Gregory Machin
- Re: please advise help with regex
- From: Rob Dixon
- Re: please advise help with regex
- From: Gregory Machin
- please advise help with regex
- Prev by Date: Re: Hash problem
- Next by Date: Re: Hash problem
- Previous by thread: Re: please advise help with regex
- Next by thread: NET::SFTP - How to close connections
- Index(es):
Relevant Pages
|
|