I've been trying to find a regex pattern to replace all youtube URLs in a string with the iframe embed code (C#). Obviously the video ID has to extracted. Here is the url patterns that should match:
- http://www.youtube.com/watch?v=bSiDLCf5u3s
- https://www.youtube.com/watch?v=bSiDLCf5u3s
- http://youtu.be/bSiDLCf5u3s
- www.youtube.com/watch?v=bSiDLCf5u3s
- youtu.be/bSiDLCf5u3s
- http://www.youtube.com/watch?feature=player_embedded&v=bSiDLCf5u3s
- www.youtube.com/watch?feature=player_embedded&v=bSiDLCf5u3s
all possible urls should be replaced with:
<iframe title='YouTube video player' width='480' height='390' src='http://www.youtube.com/embed/VIDEO_ID_EXTRACTED' frameborder='0' allowfullscreen='1'></iframe>
Can someone please point me to a right direction.
Thank you in advance