用空值替换特定URL

时间:2017-04-12 09:06:47

标签: imacros

如果要将https://en.wikipedia.org/wiki/0/替换为“null”

,我想替换该网址
       url goto={{!col4}}
       ADD !EXTRACT {{!col4}}
       TAG POS=1 TYPE=SPAN ATTR=CLASS:value<SP>block<SP>dark-gray EXTRACT=TXT
       TAG POS=2 TYPE=SPAN ATTR=CLASS:value<SP>block<SP>dark-gray EXTRACT=TXT 
       TAG POS=1 TYPE=SPAN ATTR=CLASS:value EXTRACT=TXT
       SET !EXTRACT EVAL({{!EXTRACT}}'.replace(/https://en.wikipedia.org/wiki/0//g, '').replace(/\\[EXTRACT\\]/g, 'null');")
       wait seconds=3
       SAVEAS TYPE=EXTRACT FOLDER=* FILE=test3.csv

尝试了上述代码,但对我不起作用

1 个答案:

答案 0 :(得分:0)

尝试以下方式:

url goto={{!col4}}
ADD !EXTRACT EVAL("'{{!URLCURRENT}}' == 'https://en.wikipedia.org/wiki/0/' ? 'null' : '{{!URLCURRENT}}';")
TAG POS=1 TYPE=SPAN ATTR=CLASS:value<SP>block<SP>dark-gray EXTRACT=TXT
TAG POS=2 TYPE=SPAN ATTR=CLASS:value<SP>block<SP>dark-gray EXTRACT=TXT 
TAG POS=1 TYPE=SPAN ATTR=CLASS:value EXTRACT=TXT
wait seconds=3
SAVEAS TYPE=EXTRACT FOLDER=* FILE=test3.csv