我有一个像这样的字符串:
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, https://www.youtube.com/watch?v=7TL02DA5MZM when an unknown printer took a galley of type and scrambled it to make a type
Run Code Online (Sandbox Code Playgroud)
这就是我所拥有的:
preg_match("(?:http://)?(?:www.)?(?:youtube.com|youtu.be)/(?:watch\?)?([^\s]+?)", $content, $m);
var_dump( $m );
Run Code Online (Sandbox Code Playgroud)
并希望从中提取YouTube链接。视频ID也可以。
谢谢您的帮助!