mattandmatt2000
Joined: 30 Aug 2009 Posts: 5
|
Posted: Sun Aug 30, 2009 5:25 pm Post subject: What does this script (loop) do completely? |
|
|
| Code: |
UrlDownloadToFile,%Url%,%Name%-Status.txt
FileRead,html,%Name%-Status.txt
Loop,Parse,html,`n
{
IfInString,A_LoopField,AccountGadget_Handle
{
RegExMatch(A_LoopField,">[^<]+",CL_Name)
StringTrimLeft,CL_Name,CL_Name,1
}
IfInString,A_LoopField,TicketBalance
{
RegExMatch(A_LoopField,"TicketBalance[^<]+",CTix)
StringTrimLeft,CTix,CTix,15
StringReplace,CTix,CTix,`,
}
} |
Key parts I don't understand are :
RegExMatch(A_LoopField,">[^<]+",CL_Name) ; in particular the >[^<]+ part
RegExMatch(A_LoopField,"TicketBalance[^<]+",CTix) ; in particular the ,"TicketBalance[^<]+", part
I'm essentially new to ahk and a friend gave me this code to build off of and "learn" how ahk works. I have programming experience, but I've never seen a parsing method like this. I can supply the txt file that this is originally designed for if needed. |
|
barty
Joined: 30 Aug 2009 Posts: 10
|
Posted: Sun Aug 30, 2009 8:49 pm Post subject: |
|
|
assuming that's the standard regexp implementation, and >[^<]+ is the regex you're trying to match, what that means is
match a >
follows by at least one or more characters that is NOT <
example: given a string
<a href="foo.html">click</a>
that will match
>click
TicketBalance[^<]+ will match the word TicketBalance followed by at least one or more character that is not < |
|