1

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

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

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 -->
1
  • Why are you parsing HTML/JS source as a string? Is this from an external source that you have no control over? Commented Mar 19, 2014 at 19:32

2 Answers 2

1

Try this:

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

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

Sign up to request clarification or add additional context in comments.

2 Comments

How do I get match[0] and match[1] after the command above, can I assign result to variable $matches
yes, exactly - preg_match("/file:\\s'(.*)'/uix", $searchText, $matches);
0

This will search for a single quote, followed by anything, followed by the characters video.mp4, followed by a single quote

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.