Created
May 2, 2019 07:40
-
-
Save bpongy/964e3c88557710e7c53c405ad73cf634 to your computer and use it in GitHub Desktop.
regex : YouTube URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$excerpt = preg_replace('/((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)([a-zA-Z0-9&=?_]+)?/mi', '', $excerpt); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment