Mithun Sreedharan Mithun Sreedharan - 1 year ago 193
Javascript Question

jQuery Youtube URL Validation with regex

I know there is plenty of question answered over here, but not able find a question similar to me.

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

-- update 1--
-- update 2--

This one worked almost fine, but failed for the URL

var matches = $('#videoUrl').val().match(/http:\/\/(?:www\.)?youtube.*watch\?v=([a-zA-Z0-9\-_]+)/);
if (matches) {
} else {

Answer Source

//if v can be anywhere in the query list

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download