html - PHP exploding url from text, possible? -
i need explode youtube url line:
[embed]https://www.youtube.com/watch?v=l3hqmbqawrc[/embed]
it possible? need delete [embed] & [/embed].
preg_match need.
<?php $str = "[embed]https://www.youtube.com/watch?v=l3hqmbqawrc[/embed]"; preg_match("/\[embed\](.*)\[\/embed\]/", $str, $matches); echo $matches[1]; //https://www.youtube.com/watch?v=l3hqmbqawrc
Comments
Post a Comment