Jump to content

StringRegExp


Recommended Posts

Sorry if there is documentation on this function already but I could not seem to find it in the functions reference nor could I find a good google on it.

Basically I want someone to explain this:

StringRegExp($s_IE, "<A(.*?)>", 3)

$s_IE is the document.body.innerHTML of a website. I figured that the search expression

"<A(.*?)>" is saying locate everything with a <A> tag. My question is what does the 3 mean and what exactly is the syntax of .*?

Also, how would I go about extracting links that only start with this:

Start: <a href='profile.asp=

End: '>

Link to comment
Share on other sites

The documentation for StringRegExp is in the beta help file installed with the beta version of AutoIt. The 3 in the third parameter tells StringRegExp to return an array with the text that match the pattern inside the parentheses, and find all occurances that match the pattern in the string. The pattern ".*?" is made of the atom ".", meaning match any character and a predicate of "*", which means match the preceding atom (any character) 0 or more times. The question mark tells StringRegExp to match the smallest string instead of the largest pattern (the default).

Please read the documentation included with the beta version of AutoIt and take a look at http://www.autoitscript.com/fileman/users/Nutster/ for my http://www.autoitscript.com/fileman/users/Nutster/RegExp%20Test%204.au3 for more patterns and what they can match.

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

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