Jump to content

Read a part of a link


Recommended Posts

Well, the first question's going to be, what's your attempt so far look like? (Code please)

The second question's going to be, is that string always formatted that way? As in the only variation is after "<a href="dorf1.php?a=2&c="?

Link to comment
Share on other sites

While StringSplit would be a way to go, it'd be more tedious than using a Regular Expression like this:

#include <Array.au3> ; Only necessary to display the results quickly

$String = '<a href="dorf1.php?a=2&c=4dc">' ; This would be whatever source HTML you're working off of

If StringRegExp ($String, '(?:<a href="dorf1.php\?a=)([[:alnum:]]{1,4})(?:&c=)(4dc)(?:">)', 0) Then
    $RegExp = StringRegExp ($String, '(?:<a href="dorf1.php\?a=)([[:alnum:]]{1,4})(?:&c=)(4dc)(?:">)', 1)
    _ArrayDisplay ($RegExp) ; Only necessary to display the results quickly
EndIf

Now go read the HelpFile about StringRegExp and see what all I did there.

Edited by exodius
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...