Using EVAL and .match to edit extracted source code

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
Riss
Posts: 8
Joined: Tue Jan 24, 2012 12:36 am

Using EVAL and .match to edit extracted source code

Post by Riss » Fri Mar 22, 2013 4:47 am

Hi,

I'm hoping someone can help... I've searched this forum as well as Google looking for info that could assist me with my problem which has got me this far but now I need some guidance which is specific to my project.

I'm using the following code to extract the page source code;

Code: Select all

TAG POS=43 TYPE=TD FORM=NAME:form ATTR=* EXTRACT=HTM
The result returned is this; All I want is the Number contained in the 'Value' tag, in this example 164033.
<td onmouseout="Tables.unSelectRow(this);" onmouseover="Tables.selectRow(this);" style="text-align: center; border-color: rgb(0, 0, 255); border-width: 2px; border-style: solid;"><input name="segmentsToAllocate" id="segmentsToAllocate" value="164033" onclick="SegmentsToAllocate.toggleSelectCostingSegment(this, true, true, SegmentsToAllocate.getInvoiceHeaderColumnPosition(), false); SegmentsToAllocate.calculateSummaryTotals();" type="checkbox"></td>
I thought to use the EVAL function but I am struggling with the JavaScript component of this. At the moment my code is this:

Code: Select all

SET !VAR1 EVAL("var s='{{!EXTRACT}}'; s.match(/value=+(.+?)[^0-9]/);")
I think I'm close as the result I'm getting is
value="164033","164033
but I'm not there yet... Can anyone out there please help?
User avatar
Edoctoor
Posts: 34
Joined: Sun Nov 29, 2015 7:53 pm

Re: Using EVAL and .match to edit extracted source code

Post by Edoctoor » Sat Dec 05, 2015 6:29 pm

I know it is an old post... but for anyone that still wants an answer

SET !VAR1 EVAL("var s='{{!EXTRACT}}'; s.match(/value=+(.+?)[^0-9]/); s[0]")
iMacros Version 11.0.246.4051
Browser FireFox 42.0
OS Windows 7 Home Premium - Service Pack 1

Before starting a topic please read the following; thank you!
http://forum.imacros.net/viewtopic.php?f=20&t=3331#p8799
Post Reply