Fire Posted May 25, 2010 Share Posted May 25, 2010 (edited) Hi to All Great Autoit Community.Guys i need stringregexp() help again.I`m trying to parse apache logs in win environment for this line:/aproxy/ HTTP/1.1In fact apache logs format is like this:http://httpd.apache.org/docs/1.3/logs.htmlSnippet from apache log:IP adrress of user - - [22/May/2010:07:17:35 -0700] "GET /aproxy/index.php?q=ROT13ENCODEDURLHEREGOES" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"From ssh in Linux this is not problematic extract it:Like this:user@myhost.com /logs $ grep -r '/aproxy/' accesslog_somemysite_2010 >444.txt &Also this way works in CYGWIN too.I`m trying using AUTOIT parse this log file for this pattern/aproxy/ HTTP/1.1Here is sample:(Using StringRegExp From Help file)It didn`t parse log file and exit.But i think theris problem with \ (slash).Please Guys help me in this too.Thanks in advance.$nOffset = 1 $str=FileRead(@ScriptDir&"\file.txt") While 1 $array = StringRegExp($str, '(?i)/aproxy/ (.*?)(?i)HTTP/1.1', 1, $nOffset) If @error = 0 Then $nOffset = @extended Else ExitLoop EndIf for $i = 0 to UBound($array) - 1 msgbox(0, "RegExp Test with Option 1 - " & $i, $array[$i]) Next WEnd Edited May 25, 2010 by Fire [size="5"] [/size] Link to comment Share on other sites More sharing options...
Fire Posted May 25, 2010 Author Share Posted May 25, 2010 (edited) Sorry.I figure it out.Nevermind! Seems problem with spaces. Now It works. Hope it would be usefull. /Solved $nOffset = 1 $str=FileRead(@ScriptDir&"\file.txt") While 1 $array = StringRegExp($str, '(?i)/aproxy/(.*?)(?i)HTTP/1.1', 1, $nOffset) If @error = 0 Then $nOffset = @extended Else ExitLoop EndIf for $i = 0 to UBound($array) - 1 msgbox(0, "RegExp Test with Option 1 - " & $i, $array[$i]) Next WEnd Edited May 25, 2010 by Fire [size="5"] [/size] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now