use strict;
my $str = 'https://developer.mozilla.org/es/
http://www.es.pornhub.com/
http://es.cumlouder.com/?nats=MTkzOC4xLjIuMi4wLjAuMC4wLjA
http://www.pornotube.com/orientation/straight/home/page/1
http://rubias19.com/
http://www.elreyx.com/
http://www.puritanas.com/
http://www.xvideos.com/
http://es.xhamster.com/
http://www.redtube.com/
http://es.cam4.com/
https://es.chaturbate.com/
http://new.bangbros.com/home.htm
http://www.brazzers.com/home/?nats=NDc1NzAzOjQ5MzoyNA,0,0,0,0
http://www.petardas.com/
http://www.poringa.net/
http://foxtube.com/
http://www.tubewolf.com/
http://www.youporn.com/
http://www.putalocura.com/
http://www.serviporno.com/
http://www.toropornohd.com/
http://www.aztepajas.com/
http://pornfun.com/';
my $regex = qr/(?:http|https):\/\/((?:[\w-]+)(?:\.[\w-]+)+)(?:[\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/mp;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html