我试图在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