sameer1122 Posted May 4, 2007 Share Posted May 4, 2007 I have a string - http://www.youtube.com/watch?v=xxxxxxxxxxx Can somebody help me with the code to retrive xxxxxxxxxxx from the string I tried $pattern = '/youtube\]http://(?:www\.)?youtube.com/watch\?v=([0-9A-Za-z-_]{11})[^[]*\[/youtube\]/s'; preg_match_all($pattern,$text,$matches); But it doesnt work and gives the error - preg_match_all() [function.preg-match-all]: Unknown modifier '/' Thanking you Sameer Quote Link to comment Share on other sites More sharing options...
effigy Posted May 4, 2007 Share Posted May 4, 2007 <pre> <?php $string = '[youtube]http://www.youtube.com/watch?v=xxxxxxxxxxx[/youtube]'; preg_match_all('%(?<==)(.+?)(?=\[/youtube\])%', $string, $matches); print_r($matches); ?> </pre> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.