jwk811 Posted May 29, 2009 Share Posted May 29, 2009 <?php $url="http://www.youtube.com/watch?v=gUPduAbJpsU&videos=HsyjHLxVbwo&playnext_from=TL&playnext=1"; preg_match("/[v]\=[a-zA-Z]{0,20}/",$url,$match); $result=implode(' ',$match); echo $result; ?> that gets me this: gUPduAbJpsU BUT theres a problem. if there is a number in that part it will stop at the number and only give me part of what i need. what if i wanna get the video id from a link like this: PLEASE HELP!!! Link to comment https://forums.phpfreaks.com/topic/160197-solved-preg-match-get-part-of-link-please-help/ Share on other sites More sharing options...
Ken2k7 Posted May 29, 2009 Share Posted May 29, 2009 preg_match('#v=[^&]*#', $url, $match); Link to comment https://forums.phpfreaks.com/topic/160197-solved-preg-match-get-part-of-link-please-help/#findComment-845227 Share on other sites More sharing options...
jwk811 Posted May 29, 2009 Author Share Posted May 29, 2009 preg_match('#v=[^&]*#', $url, $match); thank you! i love you Link to comment https://forums.phpfreaks.com/topic/160197-solved-preg-match-get-part-of-link-please-help/#findComment-845231 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.