Jump to content
Sign in to follow this  
will88

String

Recommended Posts

will88

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 by will88

Share this post


Link to post
Share on other sites
Authenticity

Stupid question, forgive me if it make no sense... Does the "/phpfile?s=" part remain the same?

Share this post


Link to post
Share on other sites
will88

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 same

Also 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 by will88

Share this post


Link to post
Share on other sites
Authenticity

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])

Share this post


Link to post
Share on other sites
will88

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 work

Thanks

Share this post


Link to post
Share on other sites
Authenticity

It's quite the same just change the string test and the pattern - pattern should be (I believe) '(?i)[a-z]*'

Share this post


Link to post
Share on other sites
Robjong

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)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.