multiloser Posted March 17, 2007 Posted March 17, 2007 Ok, so after I use _IEBodyReadHTML to paste the HTML of a website into a text file,I read a specific line using FileReadLine.Now what I am looking for is to be able to extract a specific string of characters from this line:<a href=.></a><a href=.></a><input type=button value="Start Research !" name=ym89na onclick="xz4wll(ym89na);"><br>The letters which I have highlighted are the characters which I want to Assign as a variable.So is there any function which would allow me to search between "name=" and " onclick="????I want to search between because the characters I want can be between 4 and 8 characters, so I cannot read a certain amount of characters, I must read the ones between the two points.Thank you in advance!
Moderators SmOke_N Posted March 17, 2007 Moderators Posted March 17, 2007 As xcal stated, _StringBetween() if you are not familiar with Regular Expressions already is an easy route... the example below will show you how to do it with just a normal between method, and with a regular expression method (You'll note for this example, there is no difference other than the use of the extra parameters)#include <string.au3> #include <array.au3> $sString = '<a href=.></a><a href=.></a><input type=button value="Start Research !" name=ym89na onclick="xz4wll(ym89na);"><br>' $aArray = _StringBetween($sString, 'Start Research !" name=', ' onclick=') _ArrayDisplay($aArray, 'Returned') $aArray = _StringBetween($sString, 'Start Research !" name=', ' onclick=', -1, 1) _ArrayDisplay($aArray, 'Returned RE')#include <array.au3> is only used so you can see the output using _ArrayDisplay(). 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now