C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
How to String If Youtube url Youtube Video Show
WhatsApp
Ashish Srivastava
Apr 26
2016
911
0
3
String strcont =
" hello "
string
pattern = @
"(?:https?:\/\/)?(?:www\.)?(?:(?:(?:youtube.com\/watch\?[^?]*v=|youtu.be\/)([\w\-]+))(?:[^\s?]+)?)"
;
string
replacement =
"<iframe title='"
+ strTitle +
"' width='560' height='315' src='https://www.youtube.com/embed/$1' frameborder='0' allowfullscreen='1'></iframe>"
;
var rgx =
new
Regex(pattern);
strcont = rgx.Replace(strcont, replacement);
How to String If youtube url youtube video Show