will88 Posted January 27, 2009 Share Posted January 27, 2009 (edited) Which string function do I use to do this? $IE = _IECreate($url,0,1,1) $Text = _IEBodyReadHTML($IE) href="/phpfile?s=randomletters" I want to get the letters where it says randomletters and the randomletters won't always be the same length, but the randomletters always end with " at the end. I've tried a bunch of string functions, but I can't seem to find one that works. Edited January 27, 2009 by will88 Password-Keeper Link to comment Share on other sites More sharing options...
Authenticity Posted January 27, 2009 Share Posted January 27, 2009 Stupid question, forgive me if it make no sense... Does the "/phpfile?s=" part remain the same? Link to comment Share on other sites More sharing options...
will88 Posted January 27, 2009 Author Share Posted January 27, 2009 (edited) Stupid question, forgive me if it make no sense... Does the "/phpfile?s=" part remain the same?yeah "href="/phpfile?s=" will always be the sameAlso im reading from an html page, so I can't use StringMid() as far as I know, because href="/phpfile?s=randomletters" isn't the only thing on the page, it may be on a differen't line sometimes or different positon on the lines Edited January 27, 2009 by will88 Password-Keeper Link to comment Share on other sites More sharing options...
Authenticity Posted January 27, 2009 Share Posted January 27, 2009 I didn't bother to check some combination like alphanumeric random key or it's always numeric ? Opt('MustDeclareVars', 1) Dim $sText, $sPattern = '[0-9]*' $sText = '<>,o,o<><,,href.,,,.,0^^"/phpfile?s=123123" a' Dim $pos = StringInStr($sText, '"/phpfile?s=') Dim $sRand = StringRegExp($sText, $sPattern, 1, $pos+StringLen('"/phpfile?s=')) MsgBox(0x10, 'title', $sRand[0]) Link to comment Share on other sites More sharing options...
will88 Posted January 27, 2009 Author Share Posted January 27, 2009 I didn't bother to check some combination like alphanumeric random key or it's always numeric ?Opt('MustDeclareVars', 1) Dim $sText, $sPattern = '[0-9]*' $sText = '<>,o,o<><,,href.,,,.,0^^"/phpfile?s=123123" a' Dim $pos = StringInStr($sText, '"/phpfile?s=') Dim $sRand = StringRegExp($sText, $sPattern, 1, $pos+StringLen('"/phpfile?s=')) MsgBox(0x10, 'title', $sRand[0])sorry letters not numbers, ill try editing that and seeing if I can get it to workThanks Password-Keeper Link to comment Share on other sites More sharing options...
Authenticity Posted January 27, 2009 Share Posted January 27, 2009 It's quite the same just change the string test and the pattern - pattern should be (I believe) '(?i)[a-z]*' Link to comment Share on other sites More sharing options...
Robjong Posted January 28, 2009 Share Posted January 28, 2009 here you go, grabs al characters from a to z $aRand = StringRegExp('href="/phpfile?s=randomletters"', "(?i)\?s=([a-z]+)", 3) ; "\?s=([^\x22&]+)" to grab everything up to the first " or & If Not IsArray($aRand) Then Exit -1 ; The random letters are now stored in $aRand[0] ConsoleWrite("Random letters: " & $aRand[0] & @CRLF) 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