Sign in to follow this  
Followers 0
KillingEye

Read a part of a link

6 posts in this topic

Hi,

html code:

<a href="dorf1.php?a=2&c=4dc">

A MessageBox should show me the "4dc".

Share this post


Link to post
Share on other sites



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="?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

1. I think i need something with stringsplit...

EDIT: but how to read the string?

2. dorf1.php?a=$var1&c=$var2

<a href="dorf1.php?a=2&c=4dc">

Edited by KillingEye

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Ok thank you...

But i dont know how to read the string out of the html code.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

How are you getting the HTML code? Using INetGet? or _IEDocReadHTML?

*Edit - At this point do you even have code to get the HTML code?

Edited by exodius

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  
Followers 0