$re = '/(http|https|ftp)\://([a-zA-Z0-9\-\.]+\.+[a-zA-Z]{2,3})(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\\\+&%\$#\=~]*)[^\.\,\)\(\s]?/';
$str = 'appro@openssl.org
appro@openssl.org
appro@openssl.org
appro@openssl.org
appro@openssl.org
http://www.openssl.org/support/faq.html
www.openssl.org/support/faq.html
http://www.openssl.org/support/faq.html
d.compressedData
https://
http://zip.allnetserveline.com/crossbrowse/chrome/chrome.zip.001
http://zip.allnetserveline.com/crossbrowse/chrome/chrome.zip.001
http://zip.allnetserveline.com/crossbrowse/chrome/chrome.zip.002
http://zip.allnetserveline.com/crossbrowse/chrome/chrome.zip.002
http://zip.allnetserveline.com/crossbrowse/chrome/chrome.zip.003
http://zip.allnetserveline.com/crossbrowse/chrome/chrome.zip.003
http://zip.allnetserveline.com/crossbrowse/chrome/chrome.zip.004
http://zip.allnetserveline.com/crossbrowse/chrome/chrome.zip.004
http://zip.allnetserveline.com/crossbrowse/chrome/chrome.zip.005
http://zip.allnetserveline.com/crossbrowse/chrome/chrome.zip.005
http://zipf.allnetserveline.com/crossbrowse/chrome/chrome.zip.001
http://zipf.allnetserveline.com/crossbrowse/chrome/chrome.zip.001
http://zipf.allnetserveline.com/crossbrowse/chrome/chrome.zip.002
http://zipf.allnetserveline.com/crossbrowse/chrome/chrome.zip.002
http://zipf.allnetserveline.com/crossbrowse/chrome/chrome.zip.003
http://zipf.allnetserveline.com/crossbrowse/chrome/chrome.zip.003
http://zipf.allnetserveline.com/crossbrowse/chrome/chrome.zip.004
http://zipf.allnetserveline.com/crossbrowse/chrome/chrome.zip.004
http://zipf.allnetserveline.com/crossbrowse/chrome/chrome.zip.005
http://zipf.allnetserveline.com/crossbrowse/chrome/chrome.zip.005
http://err.allnetserveline.com
http://err.allnetserveline.com
http://logs.allnetserveline.com
http://logs.allnetserveline.com
http://stats.allnetserveline.com
http://stats.allnetserveline.com
http://js.allnetserveline.com/crossbrowse/js/{{camp_id}}/{{secret}}/ch.js
http://js.allnetserveline.com/crossbrowse/js/{{camp_id}}/{{secret}}/ch.js
http://srch.allnetserveline.com/crossbrowse/sch/{{camp_id}}/{{secret}}/ch.json
http://srch.allnetserveline.com/crossbrowse/sch/{{camp_id}}/{{secret}}/ch.json
http://js.allnetserveline.com/crossbrowse/js/{{camp_id}}/{{secret}}/ch.js
http://js.allnetserveline.com/crossbrowse/js/{{camp_id}}/{{secret}}/ch.js
http://srch.allnetserveline.com/crossbrowse/sch/{{camp_id}}/{{secret}}/ch.json
http://srch.allnetserveline.com/crossbrowse/sch/{{camp_id}}/{{secret}}/ch.json
http://update.allnetserveline.com/crossbrowse/updater/{{camp_id}}/{{version}}/{{secret}}/update.json
http://update.allnetserveline.com/crossbrowse/updater/{{camp_id}}/{{version}}/{{secret}}/update.json
http://ipgeoapi.com/
http://ipgeoapi.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