Replace Youtube URL in Yahoo Pipes with / v from watch? V =

The previously asked question has left me with this regex in find:

^.+(\?|&)v=([a-zA-Z0-9]+).*$

Moreover, instead of replacing

hxxp://www.youtube.com/v/$1

I want to convert

hxxp://www.youtube.com/?watch="YoutubeID" 

to

Youtube.com/v/youtubeID. 

The current current regular expression does not work under this condition.

http://www.youtube.com/watch?v=67-YcLickUA

As he returns

... v = 67, not the full VideoID.

+3
source share
1 answer
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 simple replacement, but since I don’t know the context, etc., you want to use it in it, it seems so far quite well. If you need something more complicated, let me know.

+1
source

Source: https://habr.com/ru/post/1783371/


All Articles