ThanksCode:http://www.youtube.com/v/[videoid]
http://www.youtube.com/watch?v=[videoid]
http://www.youtube.com/watch?v=[videoid]&feature=blabla
ThanksCode:http://www.youtube.com/v/[videoid]
http://www.youtube.com/watch?v=[videoid]
http://www.youtube.com/watch?v=[videoid]&feature=blabla
The samples you posted don't reveal a regularity that could be used to extract the ID. Does the "videoid" follow any pattern?
db
the video id is a 11 character string that could be a-z A-Z 0-9 underscore and dash
it could be
youtube.com/?v=videoid
youtube.com/v/videoid
youtube.com/watch?v=videoid
youtube.com/watch?v=videoid&feature=whatever&this=that
i got stole this code
from here (http://gdata-java-client.googlecode....iteClient.java)Code:Pattern p = Pattern.compile("http.*\\?v=([a-zA-Z0-9_\\-]+)(?:&.)*");
Matcher m = p.matcher(input);
if (m.matches()) {
input = m.group(1);
}
return input;
i know thats what the coder used for videoid extraction but i just dont know if this solve the above
See cross post at: Please how do i extract youtube video id from these links maybe using Regex
Thanks Norm.
db
You could check the strings with .contains and depending on which one link you get is how you could cut from the strings. That is if you have a limited number of link variations.