我試圖在Youtube視頻頁面上匹配一些Javascript。該模式多數民衆贊成每個視頻同樣是這樣的:無法使用preg_match匹配此主題
<param name=\"flashvars\" value=\"somethingsomethingsomething\">
我需要擺脫一切value
,在這種情況下somethingsomethingsomething
。它被註釋掉,因爲它嵌入在Javascript中。這是我使用的代碼:
preg_match('<param name=\\"flashvars\\" value=\\"(.*)\\">', $ytPage, $match);
$ytPage
是YouTube頁面的源代碼。但是當我運行代碼$matches
永遠不會返回匹配。
有什麼我做錯了嗎?
[RegEx match open tags but XHTML self-contained tags]可能的重複(http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags) – durron597 2015-09-07 21:24:56
可能的[如何解析和處理PHP中的HTML/XML?]的副本(http://stackoverflow.com/questions/3577641/how-do-you-parse-and-process-html-xml-in-php) – 2015-09-07 21:33:30