I have a variable that holds some 100 lines in it. I need to print the lines where there is a url.
$string = "this is just a test line 1
this is a test line 2
http://somelink1
this is line 4
http://link2
...
...
I need to print only the url links.
How to print all the lines matching pattern from $string. Tried the below code.
my $resu =~ /(http(s)?://)?([\w-]+\.)+[\w-]+(/[\w- ;,./?%&=]*)?/, $string;
print $resu;