Currently, a previously answered question left me with this regex in find:
^.+(\?|&)v=([a-zA-Z0-9]+).*$
With this as replace
hxxp://www.youtube.com/v/$1
I want to convert
hxxp://www.youtube.com/?watch="YoutubeID"
to
Youtube.com/v/youtubeID.
The current regex fails under this circumstance.
http://www.youtube.com/watch?v=67-YcLickUA
As it returns
...v=67, instead of the full VideoID.
use strict;
use warnings;
my $string = 'http://www.youtube.com/watch?v=67-YcLickUA';
$string =~ s(.+watch\?v=([0-9a-zA-Z-]+))(Youtube.com/v/$1);
print "$string\n";
This is a very basic replacement, but as I don't know the context etc. you want to use it in it seems good enough for the time being. If you need anything more sophisticated, please let me know.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With