Using EVAL to remove spaces and rows from extracted text

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
Maxee
Posts: 5
Joined: Thu Sep 15, 2011 9:11 pm

Using EVAL to remove spaces and rows from extracted text

Post by Maxee » Fri Aug 02, 2013 3:56 pm

Dear all,

I would like to rise up the question of using the EVAL command for simple modifications of extracted text.

In my case when using the

Code: Select all

TAG POS=r2 TYPE=SPAN FORM=NAME:Main ATTR=* EXTRACT=TXT
I get result in the form

Code: Select all

"


the result is:

1234 Euro

thank you for searching"
I have studied the EVAL page in the wiki
but I guess because of my lack of knowledge of the java language, I am not able to understand how to "say" that I would like the spaces, new rows and text="Euro" or text="the result is:" or text="thank you for searching" to be replaced with "" (in other words I am interested in the 1234 value only).

I guess the key is in this function

Code: Select all

s.replace(\"USD\",\"\")
but I do not understand how to modify it to serve my needs.

Thank you in advance for your support and advise :)

Kind regards,

Maxee
petr
Posts: 53
Joined: Thu Jun 27, 2013 9:19 pm

Re: Using EVAL to remove spaces and rows from extracted text

Post by petr » Fri Aug 02, 2013 4:29 pm

Maxee wrote:in other words I am interested in the 1234 value
I think what you're looking for is s.match(/\d{1,})/)
Maxee
Posts: 5
Joined: Thu Sep 15, 2011 9:11 pm

Re: Using EVAL to remove spaces and rows from extracted text

Post by Maxee » Sat Aug 03, 2013 12:56 pm

Hello petr,

could you please be more precise? How do you suppose to build your code in the eval command in imacros? Could you please explain what exactly your code is doing ?

Thank you!

Maxee
petr
Posts: 53
Joined: Thu Jun 27, 2013 9:19 pm

Re: Using EVAL to remove spaces and rows from extracted text

Post by petr » Sun Aug 04, 2013 2:01 pm

To be honest, I'm still learning about EVAL in imacros, but to get only the 1234 value of the extracted test, you use regular expressions:

s.match(/\d{1,})/)

that means: "match any digit with length 1 or more". You could do the match in EVAL and set it to a VAR. Hope this helps.
janib4all
Posts: 132
Joined: Wed Jul 21, 2010 6:44 am
Location: Karachi, Sindh, Pakistan
Contact:

Re: Using EVAL to remove spaces and rows from extracted text

Post by janib4all » Sun Aug 11, 2013 1:05 pm

Are you still looking for the solution?
Hire the BoT-fReeak!
botspecialist.blogspot.com
Maxee
Posts: 5
Joined: Thu Sep 15, 2011 9:11 pm

Re: Using EVAL to remove spaces and rows from extracted text

Post by Maxee » Tue Aug 20, 2013 1:13 pm

yep I still do
User avatar
cybmatrix
Posts: 38
Joined: Tue Dec 08, 2009 8:33 pm

Re: Using EVAL to remove spaces and rows from extracted text

Post by cybmatrix » Tue Jan 21, 2014 1:58 am

Still searching for a solution ... me too.
Windows 7 PRO (64 bit)
Waterfox 51.0.1 (64 bit)
iMacros for FF 8.9.7
Post Reply