Regex and Search()

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
Posts: 1
Joined: Fri Nov 19, 2010 4:11 pm

Regex and Search()

Post by luckyg » Fri Nov 19, 2010 4:14 pm

I'm using search with regex to find codes within a page, there are multiple instances of these codes on the page. How can I use one script to extract them all, I can only seem to get the first code extracted.
Tom, Tech Support
Posts: 3448
Joined: Mon May 31, 2010 4:59 pm

Re: Regex and Search()

Post by Tom, Tech Support » Thu Nov 25, 2010 12:46 pm

Hi luckyg,

Global, iterative matching is currently not supported by the SEARCH command, so only the first match on the page can be found and extracted.

Tom, iMacros Support
Posts: 4
Joined: Wed Oct 21, 2009 6:26 am

Re: Regex and Search()

Post by Basanagouda » Thu Feb 03, 2011 12:52 pm

Hi Tom/luckyg,

We can use "SEARCH command" within loop until SEARCH returns Text, and extract them.
High level code might look something like this
MsgBox( imacroObject.iimGetLastExtract()) ' VB Script code
Until (imacroObject.iimGetLastExtract() <> "#EANF#") Or (imacroObject.iimGetLastExtract() <> "NODATA") Or (imacroObject.iimGetLastExtract() <> "")

Hope this helps :-)

Post Reply