Jan 15
RegEx to match YouTube IDs
This regular expression here can be used to match YouTube IDs:
$youtube_url =~ /watch\?v=([\w-]{11})/;
In words: \w: match any alphanumeric chars including _ (the dash), means letters, numbers; also match - (the minus); match eleven chars.It ignores further url query parameters.