I am creating a regular expression so that I can find YouTube links (maybe several) in a piece of HTML text posted by the user.
I am currently using the following regular expression to change "http://www.youtube.com/watch?v=-JyZLS2IhkQ" to display the corresponding YouTube video:
return re.compile('(http(s|):\/\/|)(www.|)youtube.(com|nl)\/watch\?v\=([a-zA-Z0-9-_=]+)').sub(tag, value)
(where the variable "tag" is the html bit, so the video works and the "value" of the user)
Now this works ... until the URL is like this:
"HTTP://www.youtube.com/watch? V = -JyZLS2IhkQ & function ...
Now I hope that you guys could help me figure out how to also combine the "& feature ..." element so that it disappears.
HTML example:
No replies to this post..
Youtube vid:
http://www.youtube.com/watch?v=-JyZLS2IhkQ
More blabla
Thanks for your thoughts, much appreciated
Stephen