Simucal Posted April 25, 2006 Share Posted April 25, 2006 (edited) Here is what I am attempting to match:"tendayIconDay0" SRC="http://image.weather.com/web/common/wxicons/31/12.gif"Except the "tendayIconDay0" can be 0-10, and the numbers in "/wxicons/31/12.gif" can be any two digit number as well. The only output I want put into the array is the actual address of the image.So, my question is:Do I have to put the items that change in the pattern into groups of their own? Like:StringRegExp($10DayFile,'(?:tendayIconDay)(?:[0-9]{1,2})(?:" SRC=")(http://image.weather.com/web/common/wxicons/)([0-9]{1,2})(/)([0-9]{1,2})(.gif)(?:")',1)Or can the groups be combined like:StringRegExp($10DayFile,'(?:tendayIconDay[0-9]{1,2}" SRC=")(http://image.weather.com/web/common/wxicons/[0-9]{1,2}/[0-9]{1,2}.gif(?:")',1)And lastly, do either of these seem valid? This is my first attempt at using StringRegExp. I have read the tutorial (which I found very helpful) but need a little more guidance.Thanks in advance,-Sim Edited April 25, 2006 by Simucal AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc) Link to comment Share on other sites More sharing options...
Simucal Posted April 25, 2006 Author Share Posted April 25, 2006 Ok, so after some further research I found that: StringRegExp($10DayFile,'(?:tendayIconDay)(?:[0-9]{1,2})(?:" SRC=")(http://image.weather.com/web/common/wxicons/)([0-9]{1,2})(/)([0-9]{1,2})(.gif)(?:")',1) Is not what I want because each sub group becomes its own item in the array. I also found that I need to set the option for StringRegExp to '3' so it will search the ENTIRE string. After further playing around with it, I saw that my second example was missing a ")" and it works great! StringRegExp($10DayFile,'(?:tendayIconDay[0-9]{1,2}" SRC=")(http://image.weather.com/web/common/wxicons/[0-9]{1,2}/[0-9]{1,2}.gif)(?:")',3) So.. I figured it out AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 25, 2006 Moderators Share Posted April 25, 2006 Ok, so after some further research I found that: StringRegExp($10DayFile,'(?:tendayIconDay)(?:[0-9]{1,2})(?:" SRC=")(http://image.weather.com/web/common/wxicons/)([0-9]{1,2})(/)([0-9]{1,2})(.gif)(?:")',1) Is not what I want because each sub group becomes its own item in the array. I also found that I need to set the option for StringRegExp to '3' so it will search the ENTIRE string. After further playing around with it, I saw that my second example was missing a ")" and it works great! StringRegExp($10DayFile,'(?:tendayIconDay[0-9]{1,2}" SRC=")(http://image.weather.com/web/common/wxicons/[0-9]{1,2}/[0-9]{1,2}.gif)(?:")',3) So.. I figured it out I have a UDF I use for this if you want it:$File = @DesktopDir & '\SomeFileName.txt' Local $receive = _StringRegExp_Between($File, "tendayIconDay", ".gif") For $i = 0 To UBound($receive) - 1 MsgBox(0, 'Info', '"tendayIconDay' & $receive[$i] & '.gif"') Next Func _StringRegExp_Between($s_FilePath, $s_Start, $s_End) $h_FRead = FileRead($s_FilePath, FileGetSize($s_FilePath)) $a_Array = StringRegExp($h_FRead, '(?:' & $s_Start & ')(.*?)(?:' & $s_End & ')', 3) If Not @error Then Return $a_Array EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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