2
In the code there is a string that contains HTML. Inside this HTML there is a embed
of a Youtube video:
<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="http://www.youtube.com/v/ZJLAJVmggt0%26hl=en%26fs=1%26rel=0%26ap=%2526fmt=18" width="725" height="400"></embed>
I need to get from this excerpt only the ID of the Youtube video, which in the above case would be the ZJLAJVmggt0
.
How to do this knowing that the string is within an iteration, that is, each cycle the variable changes value, so the above snippet is never in the same position within the string and the video ID is different with each iteration.
@Articuno, Ooops, I read wrong... (I’m gonna remove the answer in a minute)
– JJoao
It does not work, however I was able to solve using the regular expression of your reply. Thank you.
– Filipe Moraes
@Filipemoraes, What kind of error do you get? What is your version of java? (I successfully tested with java 1.8.0_45), string "t" contains more than one line?
– JJoao
The code does not extract the Youtube ID as I reported in the question. I want to get the video ID and not remove it.
– Filipe Moraes