2017-04-12 67 views
0

我想替換URL如果https://en.wikipedia.org/wiki/0/來替換爲「空」替換特定的URL用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 

試過上面的代碼,但對我不起作用

回答

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