$re = '/(?:http|https):\/\/((?:[\w-]+)(?:\.[\w-]+)+)(?:[\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/m';
$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/';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
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 PHP, please visit: http://php.net/manual/en/ref.pcre.php