use strict; use warnings; use Regexp::Common qw /URI/; my $http_and_https = qr{$RE{URI}{HTTP}{-scheme=>'https?'}}; while (my $line = ) { while ($line =~ m#($http_and_https)#gc) { print $1 , "\n"; } } __DATA__ a) black and white stuff http://test.com/testing" blah blah b) rain in spain blah blah https://chewu.to/x7w c) http://udsu.de/823; test this d) Just testing ... http://go.to/xi8jwe #goodtimes e) Super dooper. Looks nice! http://22.com/xx / http://p.de