0
votes

Is there a regex to get youtube video links or ids from embedded youtube videos on webpages?

1

1 Answers

1
votes

To find:
"<object(.*)youtube.com/v/(.*)\"(.*)</object>"

To convert to a link:
replace("<object(.*)youtube.com/v/(.*)\"(.*)</object>", '<a href="http://www.youtube.com/watch?v=\\2">click here</a>', $str)

source