Aeterna Posted March 28, 2009 Posted March 28, 2009 Hey you brilliant people out there! I'm trying to figure out how to count the number of times a string appears on a webpage. Here's my stab at it: CODE $s_String = "blahblah" $o_Body = _IEBodyReadHTML($oIE) $a_array = StringRegExp($o_Body, $s_String, 2) I tried returning that array in various ways but there didn't seem to be a method for just counting the indices of the array. Any help would be greatly appreciated!
herewasplato Posted March 28, 2009 Posted March 28, 2009 (edited) UBound($a_array) edit: Return Value Success: Returns the size of the array dimension. Failure: Returns 0 and sets @error: 1 = Array given is not an array. 2 = Array dimension is invalid. Remarks Remember that the value returned by UBound is one greater than the index of an array's last element! Edited March 28, 2009 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
Aeterna Posted March 28, 2009 Author Posted March 28, 2009 Thanks, now I have a follow up question because that msg box wasn't giving me the answer I was expecting. My question is.... what could be going wrong? CODE $oIE = _IECreate() _IENavigate($oIE, $s_URL) $s_String = "action=ma" $o_Body = _IEBodyReadHTML($oIE) $a_array = StringRegExp($o_Body, $s_String, 2) MsgBox(0, "finds", UBound($a_array)) There are 65 links on the page that have the string "action=ma" in them. But I'm getting a "1" in the MsgBox.
Authenticity Posted March 28, 2009 Posted March 28, 2009 Change 2 to 3 in the last parameter of StringRegExp, and read the help file please.
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