2017-07-09 26 views
0

我在Zapier中使用了一個typeform,其中我在2-30(本質上是一個未知數)之間接收到了typeform中文件的鏈接,並且希望將它們放入數組中zapier。使用zapier創建一個鏈接數組

我通過通知電子郵件的正文html(定義爲inputData的正文字段)獲取文本中的鏈接。每個鏈接進來的格式如下:

<a href=\'https://admin.typeform.com/form/results/file/download/<FORMNUMBER>/<VARIABLE>/<FILENAME>.pdf\'>report.pdf</a> 

我已經這樣做了,但我不斷收到空:

output = [{id: 123, hello: "world"}]; 
var array_of_matches = inputData.body.match(/href="([^"]*")/g); 
console.log(array_of_matches); 

回答

1

你的HTML有單引號的href值,但正則表達式嘗試匹配雙引號。改爲嘗試match(/href='([^']*')/g);