use strict;
my $str = 'glass shoes door window door glasses. window glasses sunglasses
glass
asdblog
{www.asdblog.iqads.net}
{http://creator.iqads.ro/NESCAFE3in1}
http://twitter.com/share
http://cdn.iqads.ro/photos/tags/11912.png
http://cluj.tecomm.ro/
http://www.godmother.ro
http://www.facebook.com/godmotherBTL
http://twitter.com/share
http://media.iqads.ro/2015/10/rm2hb-cover-400.jpg
http://media.iqads.ro/2015/09/vv-cover-800-cover-400.jpg
http://media.iqads.ro/2015/08/razvan-mitoiu-photo-cover-400.jpg
http://media.iqads.ro/2015/06/dsc7179-cover-400.jpg
http://media.iqads.ro/2015/05/raluca2-cover-400.jpg
http://media.iqads.ro/2015/05/1me-cover-400.jpg
http://cdn.iqads.ro/photos/tags/263355.png
http://cdn.iqads.ro/photos/tags/32786.png
http://cdn.iqads.ro/photos/tags/22703.png
http://cdn.iqads.ro/photos/tags/23589.png
http://cdn.iqads.ro/photos/tags/228683.png
http://cdn.iqads.ro/photos/tags/23696.png
http://cdn.iqads.ro/photos/tags/16968.png
http://cdn.iqads.ro/photos/tags/263192.png
http://www.blueidea.ro
http://www.blueidea.ro';
my $regex = qr/((?:http:\/\/+|www\.+|https:\/\/+)(?:\W+|\S+|\s+|.+)(?:\.net+|\.ro+))/mip;
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