Jump to content

How do I extract a URL from page source?


Recommended Posts

Hey everybody,

How can I extract a URL from an email? I tried using StringRegExp and some other stuff, but I couldn't really get it.. :/

I tried using StringMid to step through to get it..but that doesn't really work either, since I can't always know where the characters are gonna start.

So my question is, knowing the beginning and end of the URL...can I somehow extract just the bit I need? Like;

http://www.something.com/blah.php?var=9023...71947&end=0

I could put "?var=" and "&end=0" into a function and get a string equal to the stuff inbetween?

Thanks. :<

Link to comment
Share on other sites

  • Moderators

Ok I got it working, kind of, using a combination of string functions, only problem is, it has '&amp' instead of '&'

:S How can I fix that?

You say you "tried", but you show no "efforts"?
#include <array.au3>
$s_url = "http://www.something.com/blah.php?var=90234832094823094723054719471947&end=0"
$a_regex = StringRegExp($s_url, "(?i)(http.+?var=.+?end=.*?)", 3)
_ArrayDisplay($a_regex)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...