Extract string from page?

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
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
killm3
Posts: 2
Joined: Sat Feb 26, 2011 10:18 pm

Extract string from page?

Post by killm3 » Sat Feb 26, 2011 10:27 pm

I need to extract the value X from the following string in the source code

Code: Select all

UntrustedLink.bootstrap($(this), "X"
Value X is never more than 7 characters.

What I currently have is:

Code: Select all

SEARCH SOURCE=REGEXP:"UntrustedLink.bootstrap($(this), [^)]+[^)]+[^)]+[^)]+[^)]+[^)]+[^)]+" IGNORE_CASE=YES EXTRACT="Tracker is $1"
PROMPT {{!EXTRACT}}
But i get the feeling I'm doing this horribly wrong.

Can I get some help for a quick solution?
Tom, Tech Support
Posts: 3601
Joined: Mon May 31, 2010 4:59 pm

Re: Extract string from page?

Post by Tom, Tech Support » Tue Mar 01, 2011 1:54 am

Try the following:

Code: Select all

SEARCH SOURCE=REGEXP:"UntrustedLink.bootstrap\(\$\(this\),\s\"(.+?)\"" IGNORE_CASE=YES EXTRACT="$1"
PROMPT {{!EXTRACT}}
Online RegEx Tool
Regards,

Tom, iMacros Support
Post Reply