简体   繁体   English

PHP Regex preg比赛

[英]PHP Regex preg match

sorry to ask a question here. 很抱歉在这里问一个问题。

I have a source code below, how do I preg match the http://www5.videouploadsite.com:182/d/skxxkycgz3b4quuoh6ueyzatiu7edyaim5x57picrg67ydu4eupttmie/video.mp4 我下面有一个源代码,我该如何预匹配http://www5.videouploadsite.com:182/d/skxxkycgz3b4quuoh6ueyzatiu7edyaim5x57picrg67ydu4eupttmie/video.mp4

The pattern i am finding is video.mp4 in this case is to find string that is contain within a single quote ' ' and the ending is video.mp4 我发现的模式是video.mp4,在这种情况下,是查找包含在单引号'中的字符串,结尾是video.mp4

what kind of regex pattern should I deploy to preg match the result. 我应该部署哪种正则表达式模式来预匹配结果。

Thanks for helping 感谢您的帮助

<div id="player_code"></div>

        <script type='text/javascript'>
                    if(navigator.userAgent.match(/Android|iPhone|iPad|iPod|Mobile/i)){
                jwplayer("player_code").setup({
                    file: 'http://www5.videouploadsite.com:182/d/skxxkycgz3b4quuoh6ueyzatiu7edyaim5x57picrg67ydu4eupttmie/video.mp4',       
                    image: 'http://www5.videouploadsite.com/i/00051/663d3hthe6ym.jpg',
                    width: '100%',
                    height: '100%',
                    provider: 'http',
                    startparam: 'start',                    
                    abouttext: 'videouploadsite',
                    aboutlink: 'http://www.videouploadsite.com/',
                sharing: {
                code: '<IFRAME SRC="http://www.videouploadsite.com/embed-663d3hthe6ym.html" FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=650 HEIGHT=370></IFRAME>',
                link: 'http://www.videouploadsite.com/663d3hthe6ym'
                }
                }); 
                    } else {
                     jwplayer("player_code").setup({
                    file: 'http://www5.videouploadsite.com:182/d/skxxkycgz3b4quuoh6ueyzatiu7edyaim5x57picrg67ydu4eupttmie/video.mp4',       
                    image: 'http://www5.videouploadsite.com/i/00051/663d3hthe6ym.jpg',
                    width: '100%',
                    height: '100%',
                    provider: 'http',
                    startparam: 'start',
                    primary: 'flash',
                    skin: 'http://www.videouploadsite.com/player/J6/bekle.xml',
                    abouttext: 'videouploadsite',
                    aboutlink: 'http://www.videouploadsite.com/',
                sharing: {
                code: '<IFRAME SRC="http://www.videouploadsite.com/embed-663d3hthe6ym.html" FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=650 HEIGHT=370></IFRAME>',
                link: 'http://www.videouploadsite.com/663d3hthe6ym'
                }
                });
                }
                </script><script>
                jwplayer().addButton(
                "http://www.videouploadsite.com/player/J6/download.png",
                "Download Video", 
                    function() {
                        window.open("http://www.videouploadsite.com/663d3hthe6ym"); 
                        return false;
                    },
                    "download"
                );
            </script>


<!-- Video ADs code start here -->

Try this: 尝试这个:

preg_match("/file:\\s'(.*)'/uix", $searchText)

example: http://regex101.com/r/bL4pF7 例如: http//regex101.com/r/bL4pF7

这将搜索单引号,然后是任何内容,然后是字符video.mp4,然后是单引号

preg_match("/'.*video\.mp4'/", $text_to_search_from)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM