0
我想從內容位DailyMotion視頻網址和視頻ID多個匹配下面正則表達式匹配還有Vimeo嵌入網址的所有域和視頻的標識
<iframe style="clear: both; display: block;"
src="//www.dailymotion.com/embed/video/x1a6ldm"
height="315" width="420" allowfullscreen="" frameborder="0"></iframe>
<iframe style="clear: both; display: block;"
src="//www.dailymotion.com/embed/video/x1a6k8x"
height="315" width="420" allowfullscreen="" frameborder="0"></iframe>
<iframe style="clear: both; display: block;"
src="//www.dailymotion.com/embed/video/x1a6k1i"
height="315" width="420" allowfullscreen="" frameborder="0"></iframe>
我想下面的所有代碼,但我沒有一個工作
preg_match_all ("/^.+dailymotion.com\/(video|embed\/video)\/([^_]+)[^#]*(#video=([^_&]+))?/", $content, $dailymotionmatches, PREG_SET_ORDER);
preg_match_all ("/http:\/\/www\.dailymotion\.com\/video\/([^_]+)/", $content , $dailymotionmatches, PREG_SET_ORDER);
preg_match_all ('/http:\/\/www\.dailymotion\.com\/video\/([^_]+)/', $content , $dailymotionmatches, PREG_SET_ORDER);
我也嘗試了最大的問題在stackoverflow,但沒有找到任何解決方案,我的情況。我對正則表達式很陌生。
我測試它here
[解析器](http://simplehtmldom.sourceforge.net)。提取鏈接。用正則表達式測試網址。你也可以使用[parse_url](http://php.net/parse_url)。 – tenub
@tenub謝謝你的建議,但我需要regax! –
'。* dailymotion \ .com \/embed \/video \/[a-z0-9] +' – tenub