Reputation: 1730
I'm trying to replace the word "BHK Plot/Land" with "Plot/Land" by using the following code
TAG POS=1 TYPE=DIV ATTR=CLASS:sLB&&TXT:* EXTRACT=HTM
SET pqr {{!EXTRACT}}
SET !EXTRACT NULL
TAG POS=R1 TYPE=INPUT ATTR=TYPE:HIDDEN&&TXT:* EXTRACT=TXT
SET abc {{!EXTRACT}}
SET !EXTRACT NULL
TAG POS=R1 TYPE=INPUT ATTR=TYPE:HIDDEN&&TXT:* EXTRACT=TXT
SET def {{!EXTRACT}}
SET !EXTRACT NULL
PROMPT "{{abc}} BHK {{def}}"
SET lmn EVAL("PROMPT {{abc}} BHK {{def}}.replace(/[BHK Plot/Land]/g,'Plot\Land');")
PROMPT {{lmn}}
But the code gives me error : missing ; before statement, line: 70 (Error code: -1001)
, .the code already has ";" in it then why is it giving error?
This is the link from where I m extracting data
PROMPT "{{abc}} BHK {{def}}" ,, gives me the output "BHK Plot/Land". so trying to replace the word from prompt
.
Any suggestion on why is that will be very helpful. Thanks
Upvotes: 1
Views: 135
Reputation: 10466
You can try this regex, it has been tested in imacros and it works well:
SET abc "hellllllo"
set def " Plot/Land yes yes yes"
SET res EVAL("var re=new RegExp('BHK\\\\s*(?=Plot/Land)','g'); var str = '{{abc}}'+'BHK'+'{{def}}';str.replace(re,'');")
prompt {{res}}
output:
hellllllo Plot/Land yes yes yes
Upvotes: 1