使用REGEXP从源代码中仅提取指定的关键字/链接

时间:2016-08-25 02:38:51

标签: html regex imacros

首先,这是我制作的imacro脚本:

VERSION BUILD=11.1.495.5175   
TAB T=1  
TAB CLOSEALLOTHERS  
SET !PLAYBACKDELAY 0.2  
SET !ERRORIGNORE YES  
SEARCH SOURCE=REGEXP:"(youtube. com/([^']+))" EXTRACT=$1  
SEARCH SOURCE=REGEXP:"(dailymotion. com/embed/video/([^']+)info=0)" EXTRACT=$1 
SET !CLIPBOARD {{!EXTRACT}}  

我设法让它以某种方式工作,但运行此代码给了我类似的文本

<br> <a class="button red xLarge"
href="//www.dailymotion. com/embed/video/sample29831"
target="_blank"><span>DMOTION</span></a><br> <a class="button red
xLarge" href="//www.dailymotion. com/embed/video/sample2d9sa"
target="_blank"><span>DMOTION</span></a><br> <a class="button red
xLarge" href="//www.youtube. com/sample3hjdaks"
target="_blank"><span>youtube</span></a>

我想做的只是收集:

dailymotion. com/embed/video/sample29831 
dailymotion. com/embed/video/sample2d9sa
youtube. com/sample3hjdaks

我如何使用REGEXP实现这一目标?

1 个答案:

答案 0 :(得分:0)

以下正则表达式可能会有效:

(?<=href="\/\/).*(?<=")