Friday, January 6, 2012

[YouTube-API] Strip away video url leaving only the video ID using Java Regular expressions?


Hi ,

I want to store the video IDs of the videos that have been shown in my website, to do this I need to strip away the video url just to store the video ID. The issue is that I have read some solution to this using regular expressions, one fo the solutions suggested by Jarek Wilkiewicz was to use this PHP regular expression $pattern = '/[^=]+=([^?]+)/'; , but this expression doesn't cover all the possible formats to show a YouTube video.

So my questions are :

- Are there any specific formats for the urls to show a video? Where can I check this?
- If that is not the case, can anyone help me to find out a regular expression in Java that covers all the possible formats to show a video in Youtube urls?

Thanks in advance for any help!!!

--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To view this discussion on the web visit https://groups.google.com/d/msg/youtube-api-gdata/-/P_mosbI7j0MJ.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.

No comments:

Post a Comment