I'm looking to pull all the youtube links from a string of text and was wondering how does this look?
if (preg_match_all('/(https?:\/\/)?(www\.)?(youtube\.com)\/watch\?v=([a-zA-Z0-9_-]+)[^\s]*/im', $this->content, $matches)) {
}
Obviously this doesn't take into account the youtu.be
links as they are formatted differently.