Jump to content
Sign in to follow this  

Variable regexp?

Recommended Posts


I have the following code:

#include <array.au3>
#include <INet.au3>

$file = FileRead(@ScriptDir & "/urls.txt")
$urls = StringSplit($file, @CRLF, 1)
For $a = 1 to $urls[0]
    $urlsplit = StringSplit($urls[$a], "~")
    $format = StringSplit($urlsplit[2], "{URL}", 1)
    $url = $urlsplit[1]
    $wrapleft = $format[1]
    $wrapright = $format[2]
    $source = _INetGetSource($url)
    MsgBox(0,'',$wrapleft & "(.?*)" & $wrapright)
    $links = StringRegExp($source, $wrapleft & "(.?*)" & $wrapright, 3)
NextoÝ÷ Ù©Ý!©°¢w^®)àûayú%"¬¦,¹^jëh×6$links = StringRegExp($source, $wrapleft & "(.?*)" & $wrapright, 3)

I have a .txt file in which are urls and in those urls are links. the txt file is in this format:

http://www.url2.com~value="{URL}" type

because the wrappings around the urls are different for each website, and I still need to extract the link urls.

These urls aren't always a link, so _IEGetLinkCollection() or whatever that function is called won't work.

The links are also in a list, so just scanning the entire source for urls won't work either.

The main focus is on having a variable in a regular expression, how can I do that?

[right]~What can I say, I'm a Simplistic person[/right]

Share this post

Link to post
Share on other sites

what's your output should be like, I dont understand sorry

Share this post

Link to post
Share on other sites

There's no difference with a variable or the string as long as you've escaped the proper characters.

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.

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