These are the tags from where data is to be extracted
<div class="textForAType">
Agent
<span class="agentNameh">Vijay Realty</span>
</div>
Using the code "TAG POS=1 TYPE=span ATTR=CLASS:agentNameh&&TXT:* EXTRACT=TXT"
gives the output Vijay Realty and TAG POS=1 TYPE=div ATTR=CLASS:textForAType&&TXT:* EXTRACT=TXT
gives me O/P AgentAgent Vijay Realty
So I'm trying to replace the name "Vijay Realty" with blank in the output "AgentAgent Vijay Realty" and then count the number of characters and divide it by 2 so as to get the word "Agent"
So this happens to be the combined code
TAG POS=1 TYPE=span ATTR=CLASS:agentNameh&&TXT:* EXTRACT=TXT
SET AgentName {{!EXTRACT}}
TAG POS=1 TYPE=div ATTR=CLASS:textForAType&&TXT:* EXTRACT=TXT
SET Owner {{!EXTRACT}}
SET CertiAgent EVAL("var s=\"{{!Owner}}\"; s.replace(s.match(/{{!AgentName}}/gi),'');")
'PROMPT {{CertiAgent}}
SET !VAR1 EVAL("var x=\"{{!CertiAgent}}\"; x=x.match(/^.{(length(\"{{!CertiAgent}}\")/2)}/).join(''); x;")
PROMPT {{!VAR1}}
But running this code gives error
unterminated parenthetical, line: 8 (Error code: -1001)
I don't know what exactly the error is. Any suggestion on where I.m making a mistake . Thanks
P.s: I'm trying to extract the text after the attribute "textForAType"
Here you go... You need to remember to clear out the EXTRACT Variable, or otherwise each extraction you make will be appended to it (which is why you have "Agent" twice in the results).
The code below should resolve your issue and provide you with the value of "Agent"
TAG POS=1 TYPE=span ATTR=CLASS:agentNameh&&TXT:* EXTRACT=TXT
SET AgentName {{!EXTRACT}}
'display extracted value for testing purposes
PROMPT {{AgentName}}
'Clear the Internal Extract buffer
SET !EXTRACT NULL
TAG POS=1 TYPE=div ATTR=CLASS:textForAType&&TXT:* EXTRACT=TXT
SET Owner {{!EXTRACT}}
'display extracted value for testing purposes
PROMPT {{Owner}}
'Clear the Internal Extract buffer
SET !EXTRACT NULL
'Use Javascript evaluation to replace the "agentNameh" section of "textForAType" to (blank), and return results as CertiAgent2
SET CertiAgent2 EVAL("var x=\"{{Owner}}\"; x.replace(\"{{CertiAgent}}\",\"\");")
'display variable value for testing purposes
PROMPT {{CertiAgent2}}
If this answer helped, please mark as such.