3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $youtube = "https://www.youtube.com/watch?v=9g30pPikveg&feature=youtu.be"; preg_match("/^(?:http(?:s)?:\/\/)?(?:www\.)?(?:m\.)?(?:youtu\.be\/|youtube\.com\/(?:(?:watch)?\?(?:.*&)?v(?:i)?=|(?:embed|v|vi|user)\/))([^\?&\"'>]+)/", $youtube, $matches); echo $matches[1];
based on 9rDXl
Output for 5.3.19 - 7.2.0
9g30pPikveg