title: jQuery Youtube URL Validation with regex
body: <p>I know there is plenty of question answered over here <a href="https://stackoverflow.com/questions/tagged/youtube+regex">https://stackoverflow.com/questions/tagged/youtube+regex</a>, but not able find a question similar to me.</p>
  
  <p>Any body has the JavaScript Regular expression for validating the YouTube VIDEO URL's line below listed. Just want to know where such a URL can be possible</p>
  
  <pre><code>http://www.youtube.com/watch?v=bQVoAWSP7k4
  http://www.youtube.com/watch?v=bQVoAWSP7k4&amp;feature=popular
  http://www.youtube.com/watch?v=McNqjYiFmyQ&amp;feature=related&amp;bhablah
  http://youtube.com/watch?v=bQVoAWSP7k4
  </code></pre>
  
  <p>-- update 1--
  -- update 2--</p>
  
  <p>This one worked almost fine, but failed for the URL <a href="http://youtube.com/watch?v=bQVoAWSP7k4" rel="noreferrer">http://youtube.com/watch?v=bQVoAWSP7k4</a> </p>
  
  <pre><code>var matches = $('#videoUrl').val().match(/http:\/\/(?:www\.)?youtube.*watch\?v=([a-zA-Z0-9\-_]+)/);
  if (matches) {
      alert('valid');
  } else {
      alert('Invalid');
  }
  </code></pre>