How to String If Youtube url Youtube Video Show

  1. String strcont =" hello "    
  2.   
  3. string pattern = @"(?:https?:\/\/)?(?:www\.)?(?:(?:(?:youtube.com\/watch\?[^?]*v=|youtu.be\/)([\w\-]+))(?:[^\s?]+)?)";  
  4.         string replacement = "<iframe title='" + strTitle + "' width='560' height='315' src='https://www.youtube.com/embed/$1' frameborder='0' allowfullscreen='1'></iframe>";  
  5.         var rgx = new Regex(pattern);  
  6.         strcont = rgx.Replace(strcont, replacement);