Jump to content
Sign in to follow this  
anystupidassname

regex

Recommended Posts

anystupidassname

Assuming I'm using the InetGetSource UDF to get a list of links on the page, how could I use regex to pick the link I'm interested in assuming it will always be the only one to end in a certain way (lets say $var for example)

Thanks!


This signature is computer generated, nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#.......

Share this post


Link to post
Share on other sites
seandisanti

Assuming I'm using the InetGetSource UDF to get a list of links on the page, how could I use regex to pick the link I'm interested in assuming it will always be the only one to end in a certain way (lets say $var for example)

Thanks!

<{POST_SNAPBACK}>

I think i'm going to have to impose a limit on myself of how many times in a day i can say 'check out dale's ie.au3 to do this easier'

Share this post


Link to post
Share on other sites
Zedna

Here is my similar code snipet:

; my sample html source snipet
$html_src = '<A href="data/0507211530.gif">15:30</A> | <A href="data/0507211500.gif">15:00</A> | ...'

$names = StringRegExp($html_src, '(?i)<A href="data/(.*?)">', 3); (?i) -> case insensitive
If @Error <> 0 or @extended <> 1 Then 
    MsgBox(48, "Error", "Error finding links on the page!")
    Exit
Else
    MsgBox(48, "OK", "Number of links on the page is " & UBound($names))
EndIf

Share this post


Link to post
Share on other sites
anystupidassname

could you give more info like an example site and what link you actually want to pick out.

if your looking for some regex exampels check my sig out (_Google & _InetGetImage)

<{POST_SNAPBACK}>

For example the windows-intel file on this page

blah, assume you don't have to click yes twice and pick daily dat only...

Edited by anystupidassname

This signature is computer generated, nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#.......

Share this post


Link to post
Share on other sites
Zedna

code is kinda wrong.

what if there are other tags between A and href.

and what if they use ' instead of "

<{POST_SNAPBACK}>

My code is not wrong but only for one HTML page from which I download links to pictures from meteorological radar. In my application it's working fine.

It was just an example for somebody to start using StringRegExp.

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  

×