in reply to Re: fast greedy regex
in thread fast greedy regex
Just to give an idea of what I'm doing this is a line from the log:
2004-03-01 22:00:12 2 15.32.17.34 200 TCP_HIT 3140 326 GET http www.wahm.com http://www.wahm.com/images/vote.gif u779479 DEFAULT_PARENT 61.2.249.106 - "Mozilla/4.0 (compatible; MSIE 5.01; Windows 95)" OBSERVED none - 61.2.249.47 SG-HTTP-Service
And my regex is like this:
while (<>){ /(\S*\s*\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s +*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\". +*\")\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)/; #print "\n"; #printf "\ndate time = %s",$1; #printf "\ntime taken = %s",$2; #printf "\nc-ip = %s",$3; #printf "\nsc-status = %s",$4; #printf "\ns-action = %s",$5; #printf "\nsc-bytes = %s",$6; #printf "\ncs-bytes = %s",$7; #printf "\ncs-method = %s",$8; #printf "\ncs-uri-scheme = %s",$9; #printf "\ncs-host = %s",$10; #printf "\ncs-uri-stem = %s",$11; #printf "\ncs-username = %s",$12; #printf "\ns-hierarchy = %s",$13; #printf "\ns-supplier-name = %s",$14; #printf "\ncs(Content-Type)= %s",$15; #printf "\ncs(User-Agent) = %s",$16; #printf "\nsc-filter-result = %s",$17; #printf "\nsc-filter-category = %s",$18; #printf "\nx-virus-id = %s",$19; #printf "\ns-ip = %s",$20; #printf "\ns-sitename = %s",$21; }
Can you see whether a more explicit regex would speed the parse up?
Thanks,
js1.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: fast greedy regex
by sfink (Deacon) on Jun 08, 2004 at 04:41 UTC | |
by js1 (Monk) on Jun 08, 2004 at 20:49 UTC | |
|
Re^3: fast greedy regex
by Roy Johnson (Monsignor) on Jun 07, 2004 at 22:51 UTC | |
|
Re^3: fast greedy regex
by CountZero (Bishop) on Jun 08, 2004 at 06:18 UTC |