 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
AbsolutePressure
Joined: 28 May 2006 Posts: 31
|
Posted: Mon Apr 02, 2007 7:47 am Post subject: RegExMatch Need Tutorial beyond Help file |
|
|
Links to tutorials....please. I have blown up the search feature on this forum trying to learn RegExMatch. Many of the post are in my non native language and therefore were not to helpful for someone that doesn't understand this function even after reading the help manual and every linked word associated within the manual.
What I am trying to accomplish is taking the below quote from a URLDownloadToFile of a php file and parse out the o/s htm file names (which changes on updates) and create a variable which I can plug into a URLDownloadToFile as in example: http://www.testsite.com/project/testarea/wc003900.htm in order to obtain that file.
| Quote: | <li><a href="project/testarea/wc0003900.htm">Remote Client v3.900 for Windows</a> Filename: wc003900.htm<br>
<li><a href="project/testarea/lc003900.htm">Remote Client v3.900 for Linux</a> Filename: lc003900.htm<br>
|
Prior too this I was using a totally unpreferred method of listing out the increments one by one and deleting them based on file size using ifgreater which left my script very redundant.
| Code: |
URLDownloadToFile, http://www.testsite.com/project/testarea/wc003898.htm, C:\Program Files\AutoHotkey\temp\wc003898.htm
URLDownloadToFile, http://www.testsite.com/project/testarea/wc003899.htm, C:\Program Files\AutoHotkey\temp\wc003899.htm
URLDownloadToFile, http://www.testsite.com/project/testarea/wc003900.htm, C:\Program Files\AutoHotkey\temp\wc003900.htm
Loop C:\Program Files\AutoHotkey\temp\*.htm,0,1
{
IfGreater,A_LoopFileSize,600000, Continue
FileDelete, %A_LoopFileLongPath%
} | I know it's a dumb method but when you don't understand the help file you have to do what you have to do. Now, I'm looking to try to understand the proper way to accomplish the task via an extented tutorial or someone who will actually take the time to explain each section of the code that they post. I have a few more things I would like to try to do, but until I get the basic concept I'm dead in the water. |
|
| Back to top |
|
 |
hd0202
Joined: 13 Aug 2006 Posts: 58 Location: Germany
|
Posted: Mon Apr 02, 2007 8:35 am Post subject: Re: RegExMatch Need Tutorial beyond Help file |
|
|
Hi, why do not try another way:
| Code: |
data =
(
<li><a href="project/testarea/wc0003900.htm">Remote Client v3.900 for Windows</a>
<li><a href="project/testarea/lc003900.htm">Remote Client v3.900 for Linux</a>
)
search_start = /testarea/
search_end = "
stringlen, search_len, search_start
loop
{
stringgetpos, pos, data, %search_start%, , pos
pos++
if (pos = 0)
break
stringgetpos, pos2, data, %search_end%, , pos
pos2++
stringmid, filename, data, pos + search_len, pos2 - pos - search_len
msgbox, % filename
pos := pos2
}
|
Hubert |
|
| Back to top |
|
 |
AbsolutePressure
Joined: 28 May 2006 Posts: 31
|
Posted: Mon Apr 02, 2007 10:19 am Post subject: |
|
|
hd0202
Thank you sir for the reply. I was able to take your example and idea and work it into my project with success with very few changes to the msgbox code and to use URLDownloadToFile for that filename output.
I thank you for assisting me, and showing me a new approach. It's very clear I'm not very good with this but I still strive to learn. Thank you again. This community is very kind and helpful. I will bookmark this post as a tutorial for later use in another area for my reference. Hopefully a moderator will not delete due to such a quick reply and workaround. |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Mon Apr 02, 2007 1:45 pm Post subject: |
|
|
| AbsolutePressure wrote: | | Hopefully a moderator will not delete due to such a quick reply and workaround. |
You don't need to worry about that.
As for a RegEx tutorial, we currently believe that the brief one we have now is within the scope of what AutoHotkey's documentation should provide. We'd love your input, though, so if you think there are ways it could be improved or broadened while keeping it relatively short, feel free to post in Wish List.
Also, the RegEx used in AutoHotkey is based on PCRE, so any PCRE or Perl tutorial would be applicable to our expressions as well. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|