Jump to content

String capture problem


Recommended Posts

Hello forum. I've a problem >_< . I would to capture a part of test in a link.

This is an esample of this link :

http://wwwRANDOMNUMBER.xxxxxxx.com/files/RANDOMNUMBERANDLETTERS/THISISTHEPARTOFLINKTHATIWOLUDTOCAPUTURE

It is an esample

http://www87.xxxxxx.com/files/dfgd5h6y5fhfvnjthgj4g6h4/autoitrulez

I would to caputure the string "autoitrulez"...how i can do?

Hello

Edited by AuToItItAlIaNlOv3R
Link to comment
Share on other sites

@Info

The link generated random letters and number...

This scritp work only for the my esample.

$Pattern = "http://www[0-9]{0,}.xxxxxx.com/files/[a-z 0-9]+/"

Dim $String[7]
$String[0] = "http://www87.xxxxxx.com/files/dfgd5h6y5fhfvnjthgj4g6h4/autoitrulez"
$String[1] = "http://www3456.xxxxxx.com/files/snfg89n76dfa90ga/autoitrulez"
$String[2] = "http://www.xxxxxx.com/files/j09l3sdfg8d0fgd95a867sdf/autoitrulez"
$String[3] = "http://www1.xxxxxx.com/files/q9we8r76gf09dn809bmv/autoitrulez"
$String[4] = "http://www67856.xxxxxx.com/files/qwe0r87hf08n0g96e89r7t6/autoitrulez"
$String[5] = "http://www7567.xxxxxx.com/files/yui9876zv09er0987sg/autoitrulez"
$String[6] = "http://www456.xxxxxx.com/files/wqe987n9876sg8970bs6fd87gs9d/autoitrulez"

For $i = 0 To 6
    $Result = StringRegExpReplace($String[$i],$Pattern,"")
    MsgBox(0,"test",$Result)
Next

As you can see the same pattern will work on all strings that match the format you specified. The information on how to create patterns is in the helpfile for StringRegExp().

For instance if the random numbers and letters part can contain capital letters, you could change the pattern to:

$Pattern = "http://www[0-9]{0,}.xxxxxx.com/files/[A-Z a-z 0-9]+/"

Link to comment
Share on other sites

Thank's a lot, the nekkutta solution is simple and functional!

Now i've another problem >_<

#include <GUIConstants.au3>
#include <Ie.au3>
#include <INet.au3>
$Form1 = GUICreate("Form1", 259, 163, 339, 160)
$navigator = ObjCreate("Shell.Explorer.2")
GUICtrlCreateObj($navigator,  0, 0, 257, 161)
GUISetState(@SW_SHOW)
$pagesource = _INetGetSource ("http:www.xxxxxxxxx.com")
$pagenavigate =_IENavigate ($navigator,$pagesource)

I've this code, $pagesource creates the link for downloading a file, and $pagenavigate allows me to download it.

Now i would to suggest to the user the file name to save, how i do it ?

For esample i woult to suggest to the user the name of the file that i've grabb with nekkuta code :

$capture = StringTrimLeft($string, StringInStr($string,'/',0,-1))

How i do it? thanks for the help!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...