Subsstring form EXTRACT

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
User avatar
rrawicz
Posts: 10
Joined: Sat Jan 08, 2011 1:13 pm

Subsstring form EXTRACT

Post by rrawicz » Sat Jan 08, 2011 1:49 pm

Hi,
I need to get only a portion of text from the function EXTRACT.
For example, only the first 5 characters

variable !var2 should contain only the first 5 characters of a variable !var1

how do it?

my sample code:

Code: Select all

SET !EXTRACT NULL
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:* EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}

SET !VAR2 <??????????>
cboshdave
Posts: 53
Joined: Fri May 16, 2008 6:11 pm

Re: Subsstring form EXTRACT

Post by cboshdave » Wed Jan 19, 2011 9:57 pm

In the scripting language, you don't have that much flexibility. You will have to do that in another language and pass it into your iMacro.

So, basically, you create a program that runs an iMacro and pulls the first extraction. Do you substr on the Extraction1 and then pass it back in again and run another iMacro.

Good Luck,
cboshdave
awev
Posts: 4
Joined: Fri Oct 08, 2010 2:16 pm

Re: Subsstring form EXTRACT

Post by awev » Fri Jan 21, 2011 4:17 pm

Another option might be to use the SEARCH command, with the regular expression option. Have a look at http://wiki.imacros.net/SEARCH for use and ideas. You could tell it to match the first five charters, using something like [a-zA-Z0-9]{5} Just use care, as you may get more than you expected. Test it, test it, and test it some more, because what works this time might not work on another dataset.
phiopan
Posts: 1
Joined: Fri Feb 11, 2011 2:45 am

Re: Subsstring form EXTRACT

Post by phiopan » Fri Feb 11, 2011 3:04 am

I like this a lot
Post Reply