Regex - find all hosts inside a url -


given following url:

http://clk.atdmt.com/flo/go/364329512/direct/01/?href=http://www.****123****.com/refer.do?r=linkshare&lsid=vl0mfkzlvku-i%2akkckbqwo7zb9aqrsvlew&lsurl=http%3a%2f%2f****123****%2fcollection.do%3fdataset%3d12905%26cm_mmc%3dim_affiliates-_-linkshare-vl0mfkzlvku-_-10003079-_-3 

is there expression match hosts above? (e.g http://clk.atdmt.com, http://*123*.com....)

i need same expression work in matched string http://clk.atdmt.com

thanks

you can use (javascript flavour) extract host (capture group 1):

/http:\/\/(?:www\.)?([^\/]+)/g 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -