I have the following code
// this text box can contain a URL such as:
// http://vimeo.com/
// http://www.youtube.com/
// and so on.
var text = $('#myTextBox').val();
var providers = "youtube|flickr|viddler|qik|revision3|hulu|vimeo";
if( text.match(providers).length > -1) {
var selectedProvider = ???;
}
the match method looks if there are any sub-string that match the list of providers: youtube, flickr, vimeo etc.
My question is which provider was matched?